in reply to Re^2: "strict" violation on "sort" command with perl 5.10
in thread "strict" violation on "sort" command with perl 5.10

From the OP:
${@$a}[0]
I had to stare at that for a bit and then do a little experiment:
>perl -wMstrict -le "my @ra = qw(a b c d); my $ar = \@ra; print ${ ra}[2]; print ${ @ra}[2]; print ${ $ar}[2]; print ${@$ar}[2]; " c c c c
Sure enough, it works! I'm gobsmacked!

Needless to say, I've never seen the second and fourth forms of the array access expression, the ones using the  @ sigil apparently redundantly. These forms are certainly not widely used, but are they ever used? I.e., is there any situation in which the  @ sigil must be used in this way?

Update: Added $ that was MIA in ${@$a}[0].

Replies are listed 'Best First'.
Re^4: "strict" violation on "sort" command with perl 5.10
by ikegami (Patriarch) on Apr 29, 2009 at 00:01 UTC
    There are no reasons to use it, and one shouldn't use it.