in reply to Re^2: -> Is Optional ?
in thread -> Is Optional ?
The line
my @a = [ 1, 4, 9, 16 ]; # squares
creates an anonymous array with 4 elements, and assigns a reference to this anonymous array — i.e., a single, scalar value — to be the first (and only) element of the named array @a.
I suspect that parentheses were intended rather than square brackets:
my @a = ( 1, 4, 9, 16 ); # squares my @b = ( 1, 8, 27, 64 ); # cubes my @c = ( \@a, \@b ); # two arrays
and then the rest of the original code behaves as intended.
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
In Section
Seekers of Perl Wisdom