use strict; use warnings; my $variable = 3; if ($variable =~ /\b(?:1|2|3)\b/) { print "case 1, 2 or 3\n" } #### case 1, 2 or 3