in reply to filtering and dividing an array
For joining the two arrays into a single array below is the example. The operation will be done for the number of elements in the array1, i.e., if there are 4 elements in the list then first 4 elements will be processed irrespective of the number of elements in array2.
I am not sure whether you have asked this !!#/usr/bin/perl use Data::Dumper; ## Populating the Arrays with some values. @array1 = ( 1,2,3,4 ) ; @array2 = ( 'one', 'two', 'three', 'four' ); ## Initialise the index for the array $i = 0; ## Join the two array 'array1', 'array2' in a single array named 'arra +y' map { $array[$i][0] = $array1[$i] ; $array[$i][1] = $array2[$i]; $i++ + } @array1 ; print Dumper @array;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: filtering and dividing an array
by oko1 (Deacon) on Nov 29, 2008 at 14:03 UTC |
In Section
Seekers of Perl Wisdom