in reply to Re^2: macthing a word a in array of words
in thread macthing a word a in array of words

yes, the regex could be better. When dealing with user input, you should allow whitespace before and after the input. Some common idioms:
s/^\s+//; #remove leading whitespace s/\s+$//; #remove trailing whitespace
Now that whitespace is not a factor, for the match then anchor the search term to front and rear. /^dog$/; matches dog but not doggie let me know how you get along with those hints.