开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜