in reply to using other variables as keys to hash

This is actually a bit of refrence-tastic syntactic sugar. Here is a working version :
print("$simpsons{father}\n"); print("$$string{mother}\n"); print("${$array[0]}{son}\n"); print("${$hash{family}}{daughter}\n");
The additional currlies clarify which potion is the hash reference, and which part is the key.
speling champ of tha claz uf 1997
-- MZSanford

Replies are listed 'Best First'.
Re: Re: using other variables as keys to hash
by davorg (Chancellor) on Sep 12, 2001 at 15:18 UTC

    There aren't any hash references in this example, just symbolic references. Running your code under use strict gives the following error:

    Can't use string ("simpsons") as a HASH ref while "strict refs" in use at ./test.pl line 11. --
    <http://www.dave.org.uk>

    Perl Training in the UK <http://www.iterative-software.com>

      ok, but i think "HASH ref" means the symbolic reference was referencing a hash. you were probably correct in you're first post, that symbolic references are usually not a good idea.
      enemy of the XP whores of the world
      -- MZSanford