Arrays vs. Lists in Perl: What's the Difference?  | 3 Comments |
No TrackBacks  One of the most common sources of confusion for
new Perl programmers is the difference between arrays and lists.
Although they sometimes look similar, they are very different
things, and many bugs and misunderstandings are caused by not
having a full understanding of the differences. Even experienced
Perl programmers sometimes think arrays and lists are the same,
but they are quite different in several important ways.  Here's
a table which outlines some of the differences. Each of these
differences is discussed in detail below.  ...are
variables....are ephemeral. ...can be changed....are immutable.
...can be named or anonymous....never have names. ...use the
sigil not have sigils. ...can be referenced....distribute
references. ...can not be passed to or returned from
subroutines....are the only thing passed to and returned from
subroutines. ...can be multidimensional....are always one-
dimensional. ...have known behavior in scalar