http://www.perlmonks.org?node_id=442297


in reply to Re: Concerning hash operations (appending, concatenating)
in thread Concerning hash operations (appending, concatenating)

Is this a joke BUU?

Lets have a look at the code:

my(@array1, @array2) = @_;

So this line will magically split @_ into two parts, the first part will go into @array1 and contain the whole contents of @_, @array2 will be empty.

foreach my $element (@array2){ @array1 = (@array1, $element); }#foreach

Good thing this loop never executes as its a pretty inefficient way to add elements to an array. Perhaps the author has never heard of push.

So this entire subroutine could be replaced by:

sub array_merge{ @_ };
---
demerphq