in reply to Active State Perl 5.6.1 build 626 Trashes hashes.

You are not predeclaring a hash nor a hash reference, you are predeclaring a scalar and giving it a character string as a value, and you cannot dereference a string. You want just either one of the following:
# A hash reference can be autovivified from an undefined value my $x; # Or assign an empty hash reference my $x = {};
Update: Good point, John. I don't like to think about symbolic references, so I hardly ever consider them :-)

Replies are listed 'Best First'.
Re: Re: Active State Perl 5.6.1 build 626 Trashes hashes.
by Anonymous Monk on Aug 08, 2001 at 21:55 UTC
    i made the asumption that a pointer to a hash was not treated the same as a hash. That is,$a->{'fish'} and $a{'fish'} are these the same?If not how can I reference and deeferene both. (i.e. </CODE>$a=\{}<CODE>)
      First take a trip through 'perldoc perldata'. $a->{'fish'} is dereferencing the hash reference $a.
      $a{'fish'} is referencing an element of the hash %a.
      They are two different things using two different variables, $a and %a.

      And get ready to re-learn all this when Perl 6 comes around :-)

Re: Re: Active State Perl 5.6.1 build 626 Trashes hashes.
by John M. Dlugosz (Monsignor) on Aug 09, 2001 at 07:05 UTC
    Actually, he is dereferenceing a string, since he's not using strict. Both variables "point" to the same place though, and that was doing confusing things.