in reply to Hmmm: while(), file handle and $_ gotcha

Just want to point out that (nested) while (<WHATEVER>)'s clobber $_ because of no localization/lexicalization:
while (<DATA>) { print; # $_ is "line 0001\n" open(my $FH, "<", "file") or die($!); while (<$FH>) { ... } # $_ was clobbered by: while (<$FH>) } __DATA__ line 0001

For a better explanation, read Sins of Perl Revisited.