Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: read text file and generate an output file with information present in text file.

by 2teez (Vicar)
on Jan 28, 2016 at 09:34 UTC ( [id://1153836]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1153836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-23 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found