in reply to Using $_ in nested loops
for loops are almost the only thing which automatically localises $_. While loops do not. New scopes do not. New packages/files do not. maps and greps do. foreach does. Three argument for does not. And theres probably more things I should be listing.
Be careful, know what's happening and don't overuse $_ where using sensible variable names would be more sensible.for (@files) { open FILE, $_; while (<FILE>) { push @res, grep {ord($_)<128} split //, $_; } close FILE; }
|
|---|