http://www.perlmonks.org?node_id=608283


in reply to Finding Line numbers in a file

You're looking for the special variable $. (or its long-form variant, $INPUT_LINE_NUMBER, available when you use English). See perlvar.

If you use IO::Handle, you will be able to use $io->input_line_number (on IO objects) or input_line_number( H ) (on filehandles).