in reply to Loop 'for' and '$_'.

I would be careful about using nested $_ variables in nested "for" loops. I encountered a bug in Perl 5.8.0, to be fixed in 5.8.1, that is detailed in Unbalanced string table refcount.

The better, and less buggy, approach is to use:

for my $loop_outer (... for my $loop_innermost (...