Its easy to join two arrays at Perl to produce a new one. Just like other smaller tasks, for joining, you'll not require any function to aid you. Just a comma(,) can do the task for you.
This code will join the two arrays, and will print the new one. Joining is done using a comma. You can pass multiple arrays are separated with comma. Pretty easy.
$\ = $/;
my @array_one = (1, 3, 5, 7);
my @array_two = (2, 4, 6, 8);
my @new_array = (@array_one, @array_two);
print for @new_array;
This code will join the two arrays, and will print the new one. Joining is done using a comma. You can pass multiple arrays are separated with comma. Pretty easy.
Comments
in fact you are adding confusion by leaving the aenigmatic '$\ = $/' unexplained.
What a vain idiot, go and facebook and leave programming alone.
Thanks.
Merge means:
$a=[undef,undef, 1,2,undef,4]
$b=[undef,0, undef,2,3,5,6]
$c = merge_right($a, $b )
May result - depending on the merge policy -
undef,0,1,2,3,5,6 or
undef,0,1,2,3,4,6
Joining two lists is a trivia in Perl. You could have also make a post on how to join two strings. Definitely simpler as in C....