想请问为什么:
#!/usr/bin/perl -w
@arr = (1,2,3);
print @arr[2];
会出现:“Scalar value @arr[2] better written as $arr[2] at ./g.pl line 5.”
而以下 code 却不会
#!/usr/bin/perl -w
@arr = (1,2,3);
$ref = \@arr;
print @$ref[2]; # 我一直以为要写成 ${$ref}[2] or $$ref[2] 才是对的
谢谢^_^