my $var1=[{'a'=>'1','b'=>'2'},1];
$var1 is array reference which contains hash reference at index 0 and scalar at index 1
to derefer $var1 to array, we have to use @$var1.(which gives the 2-element array)
And for accessing single element we have to use $$var1[0] or $var1->[0].
And again $var1->[0] is a hash reference.
To derefer it, we have to use $var1->[0]{'a'}.
But the statement "@$var1->{'a'}" is invalid, since
- Hash reference is present at 0 index of the array "@$var1".
- All references are scalar, Array cannot be used to derefer at hash reference.
For more information, please refer
- Perl Data Structures Cookbook
- Bless my Referents
ais through element0of the array. Not sure what you expected of the second print statement.