in reply to Exact pattern match?

$string =~ /^(?:yes|no)\z/; \z, unlike $ or \Z, won't match before a newline at the end of the string. If you've already chomped your data or don't care about a final newline, you can use $ instead.

Refer to perlre for more on anchors in regular expressions.