Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Creating reference to hash and array

by gone2015 (Deacon)
on Apr 10, 2009 at 15:00 UTC ( [id://756850] : note . print w/replies, xml ) Need Help??


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

    Vinoth,G