You are viewing the version of this documentation from Perl 5.005_03. View the latest version
input_line_number HANDLE EXPR
$INPUT_LINE_NUMBER
$NR
$.

The current input line number for the last file handle from which you read (or performed a seek or tell on). The value may be different from the actual physical line number in the file, depending on what notion of "line" is in effect--see "" in $ on how to affect that. An explicit close on a filehandle resets the line number. Because "<>" never does an explicit close, line numbers increase across ARGV files (but see examples under eof()). Localizing $. has the effect of also localizing Perl's notion of "the last read filehandle". (Mnemonic: many programs use "." to mean the current line number.)