http://qs321.pair.com?node_id=590454


in reply to Re: How best to tell when my hash is "full" (all values defined)?
in thread How best to tell when my hash is "full" (all values defined)?

I'm not sure how your last-condition keys( %hash ) == values( %hash ) works ... isn't this always true for all hashes (the number of keys is equal to the number of values)?

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

  • Comment on Re^2: How best to tell when my hash is "full" (all values defined)?
  • Download Code

Replies are listed 'Best First'.
Re^3: How best to tell when my hash is "full" (all values defined)?
by BrowserUk (Patriarch) on Dec 18, 2006 at 16:25 UTC

    Yes, of course it should++. I was concentrating on the idea of avoiding accidental autovivification.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: How best to tell when my hash is "full" (all values defined)?
by ikegami (Patriarch) on Dec 18, 2006 at 15:50 UTC

    Yes. It should be

    keys( %hash ) == grep defined, values( %hash )

    (which can be simplified).