my @list = qw/foo bar baz/; my %hash; @hash{@list} = (); # now I can test if an element is in @list # by checking if the key exists in %hash if (exists $hash{"foo"}) { print "found foo!"; }