in reply to Re: Problem with DBM hash of anonymous arrays
in thread Problem with DBM hash of anonymous arrays

The PHASH isn't anonymous though, is it? It's the named handle of the DBM hash. I think :-/
  • Comment on Re^2: Problem with DBM hash of anonymous arrays

Replies are listed 'Best First'.
Re^3: Problem with DBM hash of anonymous arrays
by Joost (Canon) on May 17, 2005 at 11:45 UTC
    There is no "PHASH". There is a $PAHASH, which is a scalar containing a reference to an anonymous hash and there is a %PAHASH, which is a hash (tied to a dbm file), but is unrelated to $PAHASH.

    If you do $PAHASH{$something} you're refering to %PAHASH. If you do $$PAHASH{$something}, you're referering to the hash referenced by $PAHASH. This can be confusing in the beginning, I know.

    Take a look at perlreftut. But most of all, get in the habit of using strict. It'll save you from a lot of bugs.

      The way I saw it was like this:

      %PAHASH is a named hash.

      $PAHASH{key} is referring to a scalar value stored in %PAHASH.

      $$PAHASH{key}[index] is referring to a (dereferenced) scalar value, stored in an anonymous array which is a value in %PAHASH.

      This is wrong, then?

      Sorry if this seems stupid by the way...