For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > Re: Prefix printed lines on screen with a line number. Need advice.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Prefix printed lines on screen with a line number. Need advice.
nobull67@gmail.com

2006-10-01, 6:58 pm


DJ Stunks wrote:
> Jay wrote:
>
> Don't get upset, there was some good advice there. Such as when it was
> suggested to use strict; use warnings; and use the 3-argument form of
> open();
>
>
> read perldoc perlvar and look for the special Perl variable to do with
> "current line number".


Consider also using the magic ARGV filehandle and the implicit read
into $_

while(<> ) {
print "$. $_";
}

Or at the command line:

perl -ne'print "$. $_"'

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com