Array vs. List
- Array is a List of scalar containers.
> my $fruit = 'apple'; > my @array = (0, 1, $fruit); # an Array > @array[2] = 'cherry'; > say $fruit; apple > my $arrayref = [ 0, 1, $fruit ]; # an Array(ref) > $arrayref[2] = 'cherry'; > say $fruit apple > my $list = @(0, 1, $fruit); # a List > $list[2] = 'cherry'; # list holds $fruit var > say $fruit;continued...