Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am looking for something that does the opposite. Example:%h = zip @k, @v; # ( # k1 => 'v1', # k2 => 'v2', # );
I do not want iterators (CORE::each, List::MoreUtils::natatime) because then I have to break up my beautiful pipeline of list processing into several statements and flow control blocks. That is stupid and unelegant. There should exist a CORE::map-workalike as shown above that takes a list and processes in a {BLOCK} several items at a time instead of just one item at a time, but I haven't seen it yet.unzip {[$_[0], $_[1]]} %h; # ( # [k1 => 'v1'], # [k2 => 'v2'], # );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: functional opposite of zip
by Tanktalus (Canon) on Mar 03, 2009 at 00:23 UTC | |
|
Re: functional opposite of zip
by bellaire (Hermit) on Mar 03, 2009 at 01:51 UTC | |
|
Re: functional opposite of zip
by BrowserUk (Patriarch) on Mar 03, 2009 at 02:06 UTC | |
|
Re: functional opposite of zip
by roboticus (Chancellor) on Mar 03, 2009 at 11:21 UTC |