SavannahLion has asked for the wisdom of the Perl Monks concerning the following question:
In a nutshell...
my @a = qw/A B C D E F G H/; my @b = qw/7 6 5 4 3 2 1 0/; my @KEY = map {$a[$_], $b[$_]} (0 .. $#a);
How can I get rid of @a and @b by using anonymous arrays? I think I recall seeing a bit of code around here that pulls it off, or at least discusses it, but my search fu is broken.
Of worthy note:
The size of @a and @b is guaranteed to be the same size.
Can't use hashes, I need to preserve their order.
The size of each array is never more than 32ish or thereabouts.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: merging anonymous arrays
by davido (Cardinal) on Nov 16, 2012 at 08:29 UTC | |
by choroba (Cardinal) on Nov 16, 2012 at 08:37 UTC | |
by johngg (Canon) on Nov 16, 2012 at 13:29 UTC | |
by ColonelPanic (Friar) on Nov 16, 2012 at 14:24 UTC | |
by ColonelPanic (Friar) on Nov 16, 2012 at 10:33 UTC | |
by SavannahLion (Pilgrim) on Nov 16, 2012 at 08:36 UTC | |
|
Re: merging anonymous arrays
by Kenosis (Priest) on Nov 16, 2012 at 13:52 UTC | |
by teamassociated (Sexton) on Nov 16, 2012 at 16:27 UTC |