You have stylistic issues and misconceptions about the operation of perl but the overall idea of checking a hash for membership is the right idea. I'd write something in the same family as what you posted. Is this what you were looking for? A confirmation of whether you had the concept down?