http://qs321.pair.com?node_id=665546


in reply to Need help testing to see if a variable is one value or the other

This is pretty much the same as jozxyqk's reply, except it doesn't pull in given/when. The only modification to your code is to replace eq ("yes" or "no") with ~~ [ "yes", "no" ].

#!/usr/bin/perl -w use strict; my $var = "yes"; if ($var ~~ [ "yes", "no" ]) { print "You choose $var\n"; }else{ print "you chose something other then yes or no\n" }

lodin