>>>>> "JP" == Jeff Pang <pa...@uk2.net> writes:

  JP> On Nov 15, 2009, Uri Guttman <u...@stemsystems.com> wrote: 

>>>>> "PK" == Parag Kalra <paragka...@gmail.com> writes:

  >> and yes, that is declaring a constant. you can tell it is a hash as it
  >> is initialized to a hash reference. it makes little sense to me why you
  >> would declare such a beast as the reference can have its contents
  >> altered and so it really isn't constant. the symbol 'cache_result' can't
  >> have its value changed from the initial hash reference.


  JP> I would say it's an anonymous hash instead of a hash reference. :)

same thing. you can take and keep a ref to a named hash and if the name
goes out of scope you have an anon hash. these do the same thing:

        $href = {} ;
        $href = do { my %hash ; \%hash } ;

in both cases you get an anon hash or a hash ref. if you have a ref you
can't tell where it came from unless you scan the entire symbol table
and all accesible lexical pads. and even then it could be anon.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to