Hi,
How can I read the contents of a text file and print each line one by one?
I've tried the following but it only prints "something here" a whole bunch of times.
$filename='result.txt'; open( my $fh, '<', $filename ) or die "Can't open $filename: $!"; while ( my $line = <$fh> ) { print "something here $line[0]"; print "something here $line[1]"; print "something here $line[2]"; } close $fh;
Thanks
In reply to Print contents of text file line by line by TonyNY
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |