in reply to Re: Finding number of lines in STDIN
in thread Finding number of lines in STDIN

Clarification: $. is the line count for the last filehandle accessed by and of: readline (aka <>), tell(FILEHANDLE), seek, or sysseek.

You can access the line count for any filehandle with some_filehandle->input_line_number (but you have to use FileHandle or use IO::Handle first).

Note that STDIN->input_line_number is tracked separately from ARGV->input_line_number even when <ARGV> or empty <> is reading from stdin.