in reply to Re^2: Dereferencing a hash ref in an array ref
in thread Dereferencing a hash ref in an array ref
You can only get scalars using the arrow syntax, you cant get multiple values
my $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , $sth->{NAME_uc}[0 ,1 ]; __END__ 2
That is why you need curliesmy $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @$sth->{NAME_uc}[0 ,1 ]; __END__ Not an ARRAY reference at - line 3.
The arrow-less waymy $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @{ $sth->{NAME_uc} } [0 ,1 ]; __END__ 1 2
References quick referencemy $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @{ $$sth{NAME_uc} } ,'' __END__ 1 2
|
|---|