Welcome to the Monastery | |
PerlMonks |
Re^2: Default variable $_ is not getting overwrittenby Preceptor (Deacon) |
on Jul 05, 2016 at 09:02 UTC ( [id://1167212]=note: print w/replies, xml ) | Need Help?? |
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:
I think is fine, because you _are_ naming it - but still using $_ to preprocess. Likewise sometimes a for loop of the form:
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.
In Section
Seekers of Perl Wisdom
|
|