$. is reset when the filehandle is closed, but not when an open filehandle is reopened without an intervening close(). For more details, see "I/O Operators" in perlop. Because "<>" never does an explicit close, line numbers increase across ARGV