Append two arrays to form another array : Array Item « Array « Perl






Append two arrays to form another array

    

#!c:/perl/bin

@warships=('H', 'B', 'W');
@passengerships=('T', 'O', 'B');

@ships = (@warships, @passengerships);

print "@ships[0] \n";
print "@ships[1] \n";
print "@ships[2] \n";
print "@ships[3] \n";
print "@ships[4] \n";
print "@ships[5] \n";

   
    
    
    
  








Related examples in the same category

1.An array is an ordered list of scalars: strings and/or numbers.
2.Arrays: a collection of similar data elements
3.A program that prints the elements of a list.
4.Print an element in a list of variables
5.Store various type values in an array
6.Duplicate array elements
7.Mixed Lists
8.Mixed Data Assigned to Array Cells
9.Array Elements
10.Append to array
11.Get array last element
12.Creating and initializing an array with list assignment