Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 ( #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
Node Status?
node history
Node Type: note [id://1153836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2021-04-12 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?