in reply to Hash Problems

You're using the values of the array as hash references $temp_dcr{$key}{RightNavLaunchDate}; are you sure that they are actually hash references and not array references?

perldiag:

Can't coerce array into hash (F) You used an array where a hash was expected, but the array has no information on how to map from keys to array indices. You can do that only with arrays that have a hash reference at index 0.

Replies are listed 'Best First'.
Re: Re: Hash Problems
by wstarrs (Acolyte) on May 16, 2001 at 23:43 UTC
    How can I take the array out of the equation? I have tried using foreach, while loops etc... and I can't seem to get around the array. I just want to go through each key of temp_dcr and compare some of the values. Would there be a way to do this using the each function?
      The array of keys is not a problem. That's not what I was referring to.

      My suspicion is that the value of $temp_dcr{$key} is not a reference to a hash, which is what you are using it as in this snippet of code. I think that it is actually a reference to an array.

      An easy way to check is with Data::Dumper:

      use Data::Dumper; print Dumper %tmp_dcr; # if %tmp_dcr is too big, just dump $tmp_dcr{$key} for one of the keys