Anonymous hashes and anonymous arrays actually have a poor name. Actually, they are just hash resp. array references. But you can write them directly, as an expression, without having to populate a real (named) hash or array first. And that is all. You shouldn't look for more behind it all, because there is nothing.
For Perl,
$aref = [ 'a', 'b' ];
$href = { 'foo' => 123 };
is equivalent to
$aref = do { my @a = ('a', 'b'); \@ };
$href = do { my %h = ('foo' => 123); \%h };
You end up with
just a hashref and an arrayref, and nothing else.
So, a better name for them would be "anonymous hash ref" and "anonymous array ref", IMO.
And no, there are no implicit names. Perl doesn't use the names internally. It doesn't need them.
And perhaps you could look into typeglobs and stashes (Symbol Table hASHES), you might find it interesting. (Best discussion I found is in the old, 1st edition of the O'Reilly book "Advanced Perl Programming"; the second edition is a different book.)
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.