next up previous contents index
Next: Scalar Values Up: A crash-course in Perl Previous: A crash-course in Perl

Perl data structures

Perl has three data structures: scalars, normal arrays -- also known as lists -- of scalars, and associative arrays of scalars, known as ``hashes''. Normal arrays are indexed by number, starting with 0gif. Hash arrays are indexed by scalars. As mentioned before, scalar values are always named with $, even when referring to a scalar that is part of an array or hash, but entire arrays or array slices are denoted by @. Analog to entire arrays, entire hashes are denoted by %. 

Every variable type has its own namespace  which means that $var, @var, and %var are three different variablesgif. One advantage is that conflicts with reserved words are unlikely due to those three leading chars.





Ingo Melzer
Mon Aug 5 15:12:01 MET DST 1996