Perl Arrays

Watch out! This tutorial is over 7 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

Variables whose names begin with @ are arrays. If @sue is an array, it is different variable from $sue. However, members of @sue are selected by $sue[$i].

The construction $#arrname gives the maximum subscript of the array @arrname.

# Simple array constructs.
@fred = ("How", "are", "you", "today?");
print "\@fred contains (@fred).\n";

$mike = $fred[1];
print "$mike $fred[3]\n";

# The array name in a scalar context gives the size.
$fredsize = @fred;
print '@fred has ', "$fredsize elements.\n";

# The $#name gives the max subscript (size less one).
print "Max sub is $#fred\n";