in reply to Playing with non-localized $_ in nested loops.
Regarding what surprised you, a comparison of the output of these two one-liners affirms your conjecture. Neither of the following warns directly about a read:
Once a <> has been invoked, warnings will include latest readline coordinates regarless of what triggers them.% perl -le 'warn "a"' a at -e line 1. % echo "" | perl -le '<>; warn "a"' a at -e line 1, <> line 1.
By the way, this issue has bitten real live sites. I gave a lightning talk in YAPC::Israel::2004 about this.
In Section
Seekers of Perl Wisdom