>>>>> "Errin" == Errin M HMMA/IT Larsen <[EMAIL PROTECTED]> writes:
Errin> And furthermore, I will assume that the values in the hash are boolean Errin> (i.e. '1' (ones) or '0' (zeros)). Now, I want to see if the WHOLE hash Errin> is true, this being defined as every key having a value of '1'. A bit of DeMorgans Laws knowledge helps here: "ALL TRUE in my set" can be mapped to "NOT ANY FALSE in my set" Since the count of items from grep in a scalar context is 0 when ANY fails and non-zero when ANY succeeds, we can map this to: NOT ANY FALSE in my set ! scalar grep !$_ , values %things; And there's the formula! Cleaning it up a bit: if (! grep !$_, values %things) { print "everything is true!\n"; } -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>