Er, I think you made a mistake in your example. Did you really mean @h? Don't you mean %h?

Assuming that you mean %h, I personally see no difference. $r2 and $r1 are identical in all respects as far as perl is concerned. And this is my point. my $x=do { \my @anon }; is identical in all useful aspects to my $x=[];. Without using magic there is no way for an external entity to tell if a reference to an array is a reference to a named scalar that is now out of scope or if it is a reference to an array that never had a name. And since there is no way for perl to tell the difference IMO you can only be confusing people when you say a "reference to an anoymous array" in any other curcumstance than saying that the [] symbols (normally) create one.

you know all of the references to the anonymous data are accounted for.

Im not sure I understand what you mean here. I dont need to account for anonymous data. Perl does it for me. :-)

"a reference to an anonymous array containing a reference to an anonymous hash" is giving more information than saying "a reference to an anonymous array containing a reference to a hash."

My problem with this is that if used your description for the documentation for an argument for a subroutine then somebody might think that is ok to say foo([{}]) but that it not ok to say my (%h,@a); @a=(\%h); foo(\@a). If you leave the issue of anonymous objects to the discussions of how to construct one then no such confusion arises.

The latter makes me want to ask, "which hash?"

You already have a reference to it, why do you care what and or if it has a name?

Let me take this a step further. Why dont you add "lexical" and "dynamic" to your description? After all a lexical array is different from an anonymous dynamic array. (Or is it? IMO its not, but whatever :-). So why not say "a named lexical reference to an anonymous dynamic array containing a reference to a lexical anonymous hash"?

Bah! Truth be told, id rather say "an arrayref of hashrefs" than any of the above.

:-)


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

In reply to Re: Re: Re: Re: &bull;Re: On Declaration by demerphq
in thread On Declaration by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.