Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] hash error: Odd number of elements

Expand Messages
  • Jenda Krynicky
    From: susan59_98 ... You are returning a hash reference and trying to assign it to a hash. You have to use either %partSorted =
    Message 1 of 2 , Jul 1, 2002
    • 0 Attachment
      From: "susan59_98" <digregor@...>
      > I am writing a program which gives me an error: Odd number of
      > elements in hash. Why does this happen? What do I have to fix to get
      > rid of the error?
      >
      > Here is call to the call to teh subroutine.
      > #eliminate stuff
      > %partSorted = &sortParts($date,@time);
      >
      > Here is the subroutine where I create/return the hash:
      > ######sub sortParts#######################
      > #Eliminate stuff
      > sub sortParts{
      > ...
      > return (\%patthTypee);
      > }#end sortParts

      You are returning a hash reference and trying to assign it to a hash.
      You have to use either

      %partSorted = sortParts($date,@time);
      and
      return (\%patthTypee);

      or

      %partSorted = %{sortParts($date,@time)};
      and
      return (\%patthTypee);

      or

      %partSorted = sortParts($date,@time);
      and
      return (%patthTypee);

      Jenda
      =========== Jenda@... == http://Jenda.Krynicky.cz ==========
      There is a reason for living. There must be. I've seen it somewhere.
      It's just that in the mess on my table ... and in my brain
      I can't find it.
      --- me
    Your message has been successfully submitted and would be delivered to recipients shortly.