To clarify @$c[0] means the same as @{$c}[0] meaning dereference $c, take array slice
Well... I'm not sure it's that much more clear. After all, "I know what I mean, ..."
I'm still puzzled by the absence of a "... better written as ..." warning. Maybe the usage is just too far off the beaten track for warnings to stumble over.
>perl -wMstrict -le "my @c = ('foo'); print @c[0]; ;; my $c = ['bar']; print @{$c}[0]; print @ $c [0]; " Scalar value @c[0] better written as $c[0] at -e line 1. foo bar bar
In reply to Re^9: Perl list items
by AnomalousMonk
in thread Perl list items
by robertw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |