in reply to Splice an array into another array

splice operates on array elements. 'ATCGC' is a string in Perl, not an array. A string can be converted into an array and operated on as such, but in this case it seems like a lot of wasted motion:

c:\@Work\Perl\monks>perl -wMstrict -le "use Test::More 'no_plan'; use Test::NoWarnings; ;; my $DNA3 = 'ATCGC'; my @DNA3 = split '', $DNA3; ;; my $DNA4 = 'AAATTGC'; my @DNA4 = split '', $DNA4; ;; my $offset = 1; splice @DNA3, $offset, 0, @DNA4; my $newDNA3 = join '', @DNA3; ;; is $newDNA3, 'AAAATTGCTCGC', 'array splice ok'; ;; done_testing; " ok 1 - array splice ok 1..1 ok 2 - no warnings 1..2


Give a man a fish:  <%-{-{-{-<