$key = "INITIAL.LASTNAME,INITIAL2.LASTNAME2,INITIAL3.LASTNAME3"; $key2 = "INITIAL.LASTNAME,INITIAL2.LASTNAME2,."; if ($key =~ m/$key2/){ print " [just another perl hacker] \n"; }