On Oct 4, Tony Frasketi said:

Both $hash->{$key} and $$hash{$key} work fine and this also works Although I'm not sure why.... ${$hash}{$key}.

The reason ${$hash}{$key} works is because it's a generalization of $$hash{$key}. The rule of thumb is:

1. start with $HASH{key}
2. replace HASH with a block: ${ ... }{key}
3. fill the block with a hash reference: ${$hashref}{key}
4. if the contents are simple enough, braces are not needed

I seem to have a lot of problems with the perl language in that there are so many ways to accomplish (express) the same thing.... A wonderful feature but sometimes confusing as hell (to me at least).

Consider reading 'perldoc perlreftut', a tutorial to using references.

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to