http://www.perlmonks.org?node_id=1044554


in reply to comparison of character

Your loop misses a body (with curly braces).

$choice ne "Y" || $choice ne "y"

if $choice is Y, then $choice ne 'y' is true, and the whole condition is true. Or more general, if one of the branches is false, all the other branches are true, and the condition as a whole is true again.

You probably want to use while ($choice !~ /[yn]/i) { ... }, or while (!($choice eq 'y' || $choice eq ...)) { }.