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.
|
|---|