in reply to splicing two arrays together
use strict; use warnings; my @first = qw(Can unlock secret); my @second = qw(you the code?); splice(@first, $_+1, 0, $second[$_]) for reverse 0..$#second; print "@first\n";
I notice this is fairly close to one of GrandFather's solutions, but that's really because there is only one best way to do this if the requirement is to use splice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: splicing two arrays together
by GrandFather (Saint) on Jan 06, 2012 at 06:22 UTC | |
by Anonymous Monk on Jan 06, 2012 at 08:51 UTC | |
by GrandFather (Saint) on Jan 06, 2012 at 10:35 UTC | |
by choroba (Cardinal) on Jan 06, 2012 at 09:32 UTC | |
by TJPride (Pilgrim) on Jan 06, 2012 at 20:58 UTC |
In Section
Seekers of Perl Wisdom