in reply to How do I use a hash as a set?

You simply have a hash where each element in the set represents a key and its corresponding value is 1 or some other true value.
my (%fruits,%vegetables); $fruit{apple}=1; $fruit{orange}=1; $fruit{banana}=1; $vegetable{corn}=1; $vegetable{carrot}=1; #test whether apple is in the set fruit if($fruit{apple}){ #test for inclusion in a set print "apple is a fruit"; }