in reply to Re: Playing with non-localized $_ in nested loops.
in thread Playing with non-localized $_ in nested loops.

You'll only get the extra info if the filehandle read from is still open. closing the file (ARGV in the case of the diamond operator) switches it off again.

P:\test>echo "" | perl -wle "<>; warn 'Erk!'" Erk! at -e line 1, <> line 1. P:\test>echo "" | perl -wle "<>; close ARGV; warn 'Erk!'" Erk! at -e line 1.

Explicitly closing DATA once the loop completes is useful sometimes.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon