in reply to Re: Re: Re: max_strl - Get length of longest string in a hash
in thread max_strl - Get length of longest string in a hash

Looks good. But it seems that you're polluting the hash with keys KEY, VALUE, CURRENT_STATE and RESCAN_NEEDED. Although the chance that an actual application would use those keys is small, it is not 0.

You might want to bless the object as a list ref with two hash refs: one with the actual hash info, and one with your state maintenance. That way they will never be able to interfere with each other. But this will slow down access to the hash even further though. YMMV.

Liz

  • Comment on Re: Re: Re: Re: max_strl - Get length of longest string in a hash

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: max_strl - Get length of longest string in a hash
by DrHyde (Prior) on Aug 21, 2003 at 15:30 UTC
    Ahh no, CURRENT_STATE is what *really* contains the hash, and the FETCH, STORE, DELETE etc operations happen on that hash. This is effectively the same as your suggestion, as it keeps the user's data seperate from my metadata.
      You're right. I guess I should have looked closer. My bad.

      But a dereference of a list element would be faster than an extra hash lookup ;-)

      Liz