An empty list is represented as parentheses with nothing in between
#Each element of an array is a scalar value.
#Each element of an array can be accessed using the Perl syntax for scalars, $, with an index into the array.
#Perl starts counting array indices with 0.
() # Empty list.
@array = (1,2,3,'red');
print "@array\n";
print "$array[1]\n";
# Assignment.
$array[2] = 'maroon';
print "@array\n";
Related examples in the same category