in reply to Anonymous Data Structures

Does it really have to be a ref to be anonymous though? The most common use of anonymous arrays and hashes for me is in return values for subs:

sub foo{ return { bar => 'baz' }; }

You could just as easily return an anonymous hash:

sub foo{ return ( bar => 'baz' ); }

The other common place to see anonymous hash and array refs (always refs in this case) is in constuction of multi-dimentional data structures:

my $foo = [ { bar => 'baz' }, ];

So the arrayref isn't anonymous, but the hashref that is the first (and only element) is.

perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'

Replies are listed 'Best First'.
Re^2: Anonymous Data Structures
by blazar (Canon) on Jun 01, 2007 at 15:40 UTC

    You could just as easily return an anonymous hash:

    sub foo{ return ( bar => 'baz' ); }

    That is not a hash, but a list (in fact all subs only return lists) suitable for being assigned to a hash, period.

      Fair enough. My point was simply that it needn't be a reference to be an anonymous data structure.
      perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'