Public Scratchpad | Download, Select Code To D/L |
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'};