Lists Assigned to Arrays
#!/usr/local/bin/perl
@mixedData = (\@mixedData,,8,,3.14,,"Last");
printArray(@mixedData);
@mixedData = (\@mixedData,'',8,'',3.1,'',"Last");
printArray(@mixedData);
@pieces = @mixedData[4..8];
printArray(@pieces);
@all = @mixedData;
printArray(@all);
sub printArray {
my @localArray = @_;
$i = 0;
foreach $value (@localArray){
print "Cell number $i = $value \n";
$i++;
}
print "The last cell of the array is $#localArray";
print "\n\n";
}
Related examples in the same category