Re: is there a simple way get the current line number of processed file?
On Fri, May 27, 2005 at 10:31:40AM +0800, bingfeng zhao wrote:
> To parse a regular text file, I should report the line number of parsed file
> when error occured. I want to know whether perl provide a shortcut way or
> magic '$?' indicate this. I must counting myself if not.
>
> Thanks in advance
>
>
yes, $.
see perldoc perlvar
--
To see a world in a grain of sand
and a hevean in a wild flower
Hold infiniter in the palm of your hand
and eternity in an hour
.
Relevant Pages
- Re: is there a simple way get the current line number of processed file?
... I want to know whether perl provide a shortcut way or magic '$?' ... I must counting myself if not. ... RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? ... (perl.beginners) - Re: Counting lines in big number of files - in parallel.
... generates some reports for me and this script needs to count the ... But the above sequencial counting is very slow. ... You're using Perl like a batch script. ... Your first line above needs to start a shell, ... (comp.lang.perl.misc) - Re: counter program by using closure
... John W. Krahn wrote: ... how does perl know in this instance that %2d is refering ... is substituted for '%2d' in $counting. ... (perl.beginners) - Re: python vs perl lines of code
... Counting as 3 would reward things ... Well it's all over the Perl Cookbook. ... You can even find examples on my site that use imported functions (which I ... (comp.lang.python) - Re: counter program by using closure
... John W. Krahn wrote: ... how does perl know in this instance that %2d is refering to $count.. ... $counting contains the format string for printfand the first argument $clear is substituted for '%s' in $counting and the second argument ++$count is substituted for '%2d' in $counting. ... (perl.beginners) |
|