rir has asked for the wisdom of the Perl Monks concerning the following question:
Update: I'd downvote this if I could. My error was thinking $a and $b when
$_ was appropriate.
rir
The recent thread, Better algorithm or data structure?, shows that this behavior of $_ is not well known. It surprised me. It took prompting for this aspect to register (thanks, BrowserUk).
Update: reduced code to the point. This expresses that to which I was referring. Map and grep, like for can, localize $_; this makes this post nonsensical;
Be well,## perl 5.10.1 use strict; use warnings; my $oo; my @ary = ( 0, 1, 2, 3); grep $ary[$_ ], @ary; # no warning grep $ary[$oo], @ary; # warns
rir
Original verbose code:
<Reveal this spoiler or all in this thread>
Back to
Seekers of Perl Wisdom