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

Tricks, tips, one-liners, and friends

* Hash for testing for existence of keys:

my @words = qw(john mary ted larry wendel); my %dict; @dict{@words} = undef; print "larry exists \n" if exists $dict{'larry'}; print "bill exists \n" if exists $dict{'bill'}; print "bill doesn't exist \n" unless exists $dict{'bill'};