Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Using IF and OR, I'm sure there is a better way

by GrandFather (Saint)
on Dec 14, 2005 at 23:33 UTC ( [id://516802] : note . print w/replies, xml ) Need Help??


in reply to Using IF and OR, I'm sure there is a better way

This may do it for you:

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

Prints:

case 1, 2 or 3

DWIM is Perl's answer to Gödel