in reply to Array to Hash

Use a hash slice:
my @array = qw/foo bar baz quux/; my %hash; @hash{@array} = (1) x @array;
If you don't care about the keys having values, but just want them to exist, you can just do:
@hash{@array} = ();
But now you need to test for existence in the hash by using exists:
print "foo is there" if exists $hash{foo};