in reply to Re: Re: Checking for defined-ness for a list
in thread Checking for defined-ness for a list

Well, I thought of something obvious along the lines of:

my $undefined; while my $key (qw/A B C/) { $undefined = 1, last unless defined $hashref->{$key}; } if ($undefined) { # at least one key undefined } else { # all keys defined }
I'd say this is faster than the grep/map approach when the list of keys to test is long. It also depends on the probability of a key being undefined. Try and Benchmark some real-life examples and you get a definitive answer concerning the speed.

-- Hofmator