more useful options | |
PerlMonks |
Re: Re: Re: "foreach" is to "next" as "map" is to ???by sacked (Hermit) |
on May 26, 2004 at 16:45 UTC ( [id://356642]=note: print w/replies, xml ) | Need Help?? |
I meant "equivalent" in the sense that @odds is the same after both the map and the foreach. As far as equivalent code, I'd argue that this is closer to the map than your for loop using unless: In the same way that the original foreach using next does not evaluate the push for every iteration, your code using push/unless does not evaluate the push every iteration. --sacked
In Section
Seekers of Perl Wisdom
|
|