in reply to syntax issue

Hi there Sue! I'm not a core dev, so I don't know the why of not being able to use this syntax. We may be able to patch it so you *can* use that syntax, but it would be a bit of a bother, probably. Perl doesn't really have hard and fast rules about differences between types, so a hash could be seen as a list, and can be assigned from one to the other without the need of any type casting macros:
$ cat /tmp/foo my %foo = ('a' => [ 'A','B' ], 'b' => 'B', 'a b' => 'A B' ); my @foo = %foo; my $foo = \@foo; print( "list: [@foo]\n", "listref deref: [@$foo]\n", ); __DATA__ list: [a ARRAY(0x1f12d48) a b A B b B] listref deref: [a ARRAY(0x1f12d48) a b A B b B]
The @{...} around the reference is an explicit de-reference of the value between the { and }. Say you had "@$foo_bar", is this an attempt to de-reference $foo as an arrayref, followed by the string "_bar"? If so, you're doing it wrong, and it should instead be "@{$foo}_bar" Moo, C.J.

Replies are listed 'Best First'.
Re^2: syntax issue
by ikegami (Patriarch) on Dec 28, 2011 at 19:21 UTC
    nit: There's no such thing as a reference to a list in Perl. Your so-called listrefs are array references.