A Divendres 20 Octubre 2006 00:34, Gerald Host va escriure:
> I'm trying to read a text file line-by-line.
>
>                     open IN, shift;
>                     my @lines=split("\n",<IN>);
>                     foreach my $line (@lines) {
>                             print OUT "QQQ $line QQQ\n";
>                             }
>
> The problem is that it always gives me the entire file, not line by line.
> What did I do wrong?  Other things I've tried:
>
>                 open IN, shift;
>                 while (my $line =<IN>) {
>                             print OUT "QQQ $line QQQ\n";
>                             }
>
>
> Ryan

Im my @lines you are giving all the file in one shot. read de the file line by  
line using a while loop inserting all last chunk of code into it.

-- 
Xavier Mas

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to