How to get the current line number of a file open using Perl?
Use $.
(see perldoc perlvar
).
You can also do it through OO interface:
use IO::Handle;
# later on ...
my $n = $fp->input_line_number();
This is in perldoc perlvar, too.
Use $.
(see perldoc perlvar
).
You can also do it through OO interface:
use IO::Handle;
# later on ...
my $n = $fp->input_line_number();
This is in perldoc perlvar, too.