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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.