in reply to Name "main::a" used only once: possible typo
This is a common problem with no known great solution (if there is a great solution I hope someone will show it so that we can submit patches). It also annoys anyone using List::MoreUtils pairwise, for about the same reason. Several ideas were tossed around in the List::MoreUtils RT as to how to fix the problem, but none were ideal, and none fixed it in 100% of use cases (including my attempt).
The easiest solution is still annoying, and looks like this:
reduce { no warnings 'once'; $a * $b } 1 .. 6;
Update: I see that the List::Util RT suggests something like this:
reduce { our ( $a, $b ); $a * $b } 1 .. 6;
Dave
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Name "main::a" used only once: possible typo
by ikegami (Patriarch) on Mar 06, 2013 at 04:48 UTC | |
by szabgab (Priest) on Mar 06, 2013 at 05:16 UTC | |
by AnomalousMonk (Archbishop) on Mar 11, 2013 at 17:27 UTC |
In Section
Seekers of Perl Wisdom