while (<HANDLE>) is short for
while (defined($_ = <HANDLE>)), which
sets $_ but does not localize it. You can use a different variable explicitly:
while (my $line = <HANDLE>) (the implied "defined" on the result of the assignment is still added), or, beginning in 5.10, you can lexicalize $_:
foreach (@blah) {
do stuff with $_ from @blah
{
my $_;
while (<HANDLE>) {
do stuff with $_ read from the handle
}
}
do stuff with $_ from @blah
}