in reply to Comma separated list into a hash

One alternative to an explicit loop is to use a hash slice to set multiple keys at once. If you are not using the values, only using a hash to count unique keys, you can even assign an empty list. Looks like this:
# yes, the %hash gets a @ in front to show that we are going to use mu +ltiple keys; perl knows it's really %hash being used instead of @hash + because of the {} @hash{KEYLIST} = (); print "unique keys: ", scalar keys %hash;
where KEYLIST can be any expression returning a list, e.g. split ...