in reply to splicing two arrays together

Here is one way:
use strict; use warnings; my @first = qw(Can unlock secret); my @second = qw(you the code?); my $i = 1; while ( my $word = shift @second ){ splice @first, $i, 0, $word; $i += 2; } print join ' ', @first;

Replies are listed 'Best First'.
Re^2: splicing two arrays together
by morgon (Priest) on Jan 06, 2012 at 00:04 UTC
    Or like this maybe:
    use strict; use warnings; my @first = qw(Can unlock secret); my @second = qw(you the code?); my $result = join " ", map { ($first[$_], $second[$_]) } (0..$#first); print $result;