In article <000701c19bba$0af78320$1f58a9cb@S7575530>, Leon wrote:
> {
> my $count = 0;
> open FILE, 'perl_script.pl' or die "$!\n";
> while (<FILE>){
> $count++;
> print "Line $count: $_";
> };
> close FILE;
> };
You could even do that in a one-liner:
$ perl -pe'printf("%03i : ", $.)' perl_script.pl
or, under Windows:
C:\> perl -pe"printf('%03i : ', $.)" perl_script.pl
The $. variable hold the number of the current line
being read. (see perldoc perlvar)
--
briac
Six darting carps. Joshu
departs near a dojo.
Five old men. A dove.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]