assigning back to an array

rxl124_at_hehe.com
Date: 02/25/04


Date: 25 Feb 2004 01:20:54 -0800

I have files that I only need one field that I need to grep it out and
I am trying to assign that to another file.

(It happens that one field that I am looking for has some other character
that I dont need so I am pulling it out w/ substr commands).

However --> @real_num = substr($num, 91,10) is only pulling the last line
of the file(not the 100 other lines).

Can someone please tell me what I am doing wrong here?

Please Please help as I am driving myself mad on this one.

#!/usr/bin/perl -w

open(FH, "files.txt") || die;
@yahoo = <FH>;
foreach $num (@yahoo){
      @real_num = substr($num ,91, 10);
}
open(NF, ">hanabbs2.log") || die;
     foreach $num (@real_num){
           print NF "$num\n";
     }
close(NF);



Relevant Pages

  • Re: assigning back to an array
    ... > use strict; ... Why are you reading the whole file into an array ... > die() statement ... out what do not grep from complete.log ...
    (comp.lang.perl)
  • Re: smash and grab
    ... close HOST or die $!; ... foreach $box (@boxes) { ... print DENY "$tim\n"; ...
    (perl.beginners)
  • Re: system call issues
    ... foreach $protein { ... foreach $protein2 { ... close TEMP; ... or die "Cannot open pipe from 'TMalign' $!": ...
    (perl.beginners)
  • Re: Using a Perl script in AIX / Unix
    ... use warnings; ... opendir my $dh, $dir or die $!; ... why not put both tests in the first grep: ...
    (perl.beginners)
  • Re: Open All files one by one
    ... foreach $line { ... sub ReadFile{ ... my $file = shift @_; ... open or die "Could not open file $file"; ...
    (comp.lang.perl.misc)