Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: reduce like iteratorsby JavaFan (Canon) |
on Jan 03, 2011 at 19:05 UTC ( [id://880237]=note: print w/replies, xml ) | Need Help?? |
You have to be careful with any state solution. They'll work fine until you go through the same code path again (due to a loop, the sub it's in called again, etc). Being a state variable, it'll retain whatever was in it last. So you have to be careful you aren't comparing the last element of the first list with the first element of the second list.
It needs some additional hackery to deal with undefs correctly.
In Section
Seekers of Perl Wisdom
|
|