in reply to Creating reference to hash and array

The problem is that:

sub Create_hashref{ {@_}; };
is less than unambiguous... It might look like an anonymous hash constructor to you, but it's actually a BLOCK containing the rather trivial expression @_, whose value is the length of the @_ array. This:
sub Create_hashref{ return {@_}; };
takes a different view. As does:
sub Create_hashref{ +{@_}; };

This is discussed in Making References -- see paragraph 3.

Replies are listed 'Best First'.
Re^2: Creating reference to hash and array
by vinoth.ree (Monsignor) on Apr 11, 2009 at 04:28 UTC

    Fantastic! Thanks