Array reference and dereferencing
For example,
my @array = @{$element->{$key}{'test'}}};
print @array; # It shows an array reference
use Data::Dumper;
print Dumper @array;
# It prints $VAR1 = [ '1'
开发者_StackOverflow中文版 2'
]
How do I access these values and how do I deference the array?
Try:
print $array[0]->[0];
print $array[0]->[1];
It looks like @array
is ending up as an array that holds just one element; that one element is a reference to an array holding 1 & 2.
精彩评论