I would probably write it like this (Although, I'm not sure what that :58 is 
about): 

open(FILE, "file1.txt") or die "Can not open file. ", $!, "\n";
@lines = grep { /:58/ } <FILE>;

So you can understand and learn, let me just tell you you're mistakes.

open(FILE, "file1.txt") or die "Can not open file.  $! \n"; #or bounds 
looser. Get in the habbit for using this instead, because if you said "open FILE, 
"file1.txt" || die "Cannot open file. $!\n";" it wouldn't do what you expected.
while ($line = <FILE>) {
    if ($line =~ /:58/) { #I don't understand why, but I'm assuming this is 
what you want
        #You didn't need another loop here
      push (@line, $line); #by saying @lines = $lines, you're changing the 
entire array. Just push $lines to the end.
    }
}


In a message dated 2/22/2004 12:05:29 AM Eastern Standard Time, 
[EMAIL PROTECTED] writes:
open(FILE, "file1.txt") || die "Can not open file.  $! \n";
while ($line = <FILE>) {
    if ($line =~ /:58/) {
      #print $line; ## For Debugging Only
        foreach ($line) {
            @lines = $line;
        }
    }
}
print "@lines";



-Will
-----------------------------------
Handy Yet Cryptic Code. 
Just to Look Cool to Look at and try to decipher without running it.

Windows
perl -e "printf qq.%3i\x20\x3d\x20\x27%c\x27\x09.,$_,$_ for 0x20..0x7e"

Unix
perl -e 'printf qq.%3i\x20\x3d\x20\x27%c\x27%7c.,$_,$_,0x20 for 0x20..0x7e'

Reply via email to