Mixed Data Assigned to Array Cells : Array Item « Array « Perl






Mixed Data Assigned to Array Cells

    


#!/usr/local/bin/perl

$i = 0;
$mixedData[$i] = \@mixedData;
$mixedData[2] = 8;
$mixedData[6] = "last cell";
$mixedData[4] = 3.4;

foreach $value (@mixedData){
    print "Cell number $i = $value \n";
    $i++;
}
print "\n\n";
print "The last cell of the array mixedData is $#mixedData";
print "\n\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.Append two arrays to form another array
7.Duplicate array elements
8.Mixed Lists
9.Array Elements
10.Append to array
11.Get array last element
12.Creating and initializing an array with list assignment