Whilst I would generally agree, there's a few places where I consider using $_ to be reasonable. They're mostly the places where I'm not using it explicitly.
So something like:
while ( <$input> ) {
chomp;
my @row = split;
#stuff
}
I think is fine, because you _are_ naming it - but still using $_ to preprocess. Likewise sometimes a for loop of the form:
$_ -> methodcall() for @objects;
I'm increasingly starting to appreciate it - and as a rule of thumb, if I'm actually _writing_ $_ outside of a single line command (e.g. map/grep/for) then I should be using a named variable. |