TonyNY has asked for the wisdom of the Perl Monks concerning the following question:
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
Back to
Seekers of Perl Wisdom