Perlaccess : Tutorials : Variables
Joining Arrays (3.3)
by Jacob A. Wheeler
http://www.bigresources.com

There may come a time when you need to combine arrays. I'm going to not only show you some tricks to combine lists quickly and easily, but also an easy way to save time when creating pre-defined arrays.

  1. @array1 #Your first array
  2. @array2 #Your second array
  3. push(@array1,@array2); #The second array is now appended to the first array

Here is a quick way to create a pre-defined array.

  1. @array1 = ("Apple","Plum","Orange","Pear"); #The long way
  2. @array2 = qw(Apple Plum Orange Pear); #The quick way, works the same as above