On 10/28/07, yitzle <[EMAIL PROTECTED]> wrote:
snip
> Arrays can be set from lists and arrays get converted to lists all the time.
> Is there any practical difference? (Other than the fact that an array
> has a reference which can be passed as a scalar?)
snip

There are several key differences and it is always important to know
what you are dealing with.  For instance, an array in scalar context
yields the number of elements it contains, but a list yields the last
item.  Take this code for example:

#!/usr/bin/perl

use strict;
use warnings;

sub foo { return qw<a b c d> };
my $scalar = foo();
print "$scalar\n";

If foo returned an array then $scalar would be 4, but since function
returns are lists it is d.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to