in reply to Check if a variable contains only one letter?

(edit) I have to now agree with the other posters, that my interpretation of the question is just one of many. The below is a simple answer to one of those interpretations.

I can't believe everyone's missed the obvious!

$myvar =~ /X/i && $myvar !~ /[A-WYZ]/i

If you want to try putting it all in one regexp, see this meditation- Matching and nonmatching multiple regexps at once

And if you want it to be Unicode-safe, not just matching ASCII- I'm sure it can be and should be done, but I'm not the one to ask...

(edit #2) And if you really want to know if a string is a single letter X then don't use regexp. $myvar eq 'X'