Problems? Is your data what you think it is? | |
PerlMonks |
RFC: List::Extractby lodin (Hermit) |
on Nov 24, 2007 at 20:17 UTC ( [id://652756]=perlmeditation: print w/replies, xml ) | Need Help?? |
Description I have a module I currently call List::Extract that has a single subroutine: extract. It's used like It removes and returns the elements that tests true for the code in the block, like grep and splice combined. The code above is equivalent to
Motivation The reason I wrote this routine was that I haven't found any idiom to achieve the same thing that I'm pleased with. The only other way that I'm lazy enough to write that's significally shorter and logically simpler than the code above is but I don't like that, mostly because it duplicates the logic in the grep block, and factoring it out would make it unpretty again: and still I iterate the array twice. My questions
lodin Update: Uploaded as List::Extract to CPAN.
Back to
Meditations
|
|