On Mon, Jul 09, 2001 at 04:30:26PM +0530, baby lakshmi wrote:
> What is the difference between list and an array??
> May be this very small question. but i would like to know the difference.

There is a difference between a list and an array, despite what some people
have told you (I won't name names).  The distinction is maintained in any
good Perl book, and in all of the Perl documentation.

The difference is very simple: a list is immutable (you cannot modify it),
and an array is mutable (you can modify it).

This mutability relates to the length of the data, not the values of each
element.  For example, in list assignment you modify the values of each
element:

    ($foo, $bar) = qw(bar foo);

but the length of the list is not changed, so the list itself has not been
modified.

Whereas, with an array, you can use the push, pop, splice, etc. operations to
modify the length.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to