On Tue, 09 Sep 2014 23:09:52 +0200
lee <l...@yun.yagibdah.de> wrote:

> my $i = 1;
> my $f = 2.5;
> my $s = 'string';
> my $list = (1, 2, 3);

No, the count of items in the list gets stored in $list: $list == 3

> my $list_reference = [(1, 2, 3)];
> my $dereferenced_list = $@list_reference;

my @dereferenced_list = @$list_reference

> my @artificial_array = $@list_reference;

my @artificial_array = @$list_reference;

> my @true_array = ?
> 
> 
> I'm finding this very confusing.  What's the benefit of using extra
> designators for some types of variables (arrays) while not even having
> any at all for some others (lists)?

Lists are sequences used by Perl. They are very short lived, seldom
longer than one statement.

An array is memory. It may be named, like `@array`
or anonymous, `[ 1, 2, 3 ]`

BTW, another way to dereference a array reference is:

    my @array = @{ $list_reference };

but most people don't want to type the extra characters.


-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to