http://qs321.pair.com?node_id=1153836


in reply to Re: read text file and generate an output file with information present in text file.
in thread read text file and generate an output file with information present in text file.

Or Instead of using my $i = 0;
Could use $INPUT_LINE_NUMBER $.
like so:

while (...) { print $., .... }
And perl take care of the rest for you!

Update:

Need I mention, that to use the full name as $INPUT_LINE_NUMBER you have to use English; module.
like so:

use warnings; use strict; use autodie qw/open close/; use English; open my $fh, '<', $ARGV[0]; while ( my $line = <$fh> ) { print $INPUT_LINE_NUMBER, " ", $line; } close $fh;

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
  • Comment on Re^2: read text file and generate an output file with information present in text file.
  • Select or Download Code