P
Pradeep Patra
Hi all,
I want to merge more than 2 arrays.
For example:
@array1 = (1,2,3);
@array2 = (4,5,6);
@array3 = (7,8,9);
@array4 = (10,11,12);
my @array;
@array = (@array1,@array2,@array3,@array4);
print "Array elementsarray";
It works and displays 1-12. But I need something different because i
dont know the value of "n" beforehand. So I decided to use a for loop.
I tried push but it did not work. I would appreciate any help to merge
multiple array elements preferably not using any library function like
push etc.
for (my $i = 1; $i < 3; $i++)
{
@array =(@array1,@array."$i+1"); ---> To add array1 to array 4 and
return final array
}
Regards
Pradeep
I want to merge more than 2 arrays.
For example:
@array1 = (1,2,3);
@array2 = (4,5,6);
@array3 = (7,8,9);
@array4 = (10,11,12);
my @array;
@array = (@array1,@array2,@array3,@array4);
print "Array elementsarray";
It works and displays 1-12. But I need something different because i
dont know the value of "n" beforehand. So I decided to use a for loop.
I tried push but it did not work. I would appreciate any help to merge
multiple array elements preferably not using any library function like
push etc.
for (my $i = 1; $i < 3; $i++)
{
@array =(@array1,@array."$i+1"); ---> To add array1 to array 4 and
return final array
}
Regards
Pradeep