Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by cosmicperl (Chaplain)
on Dec 14, 2005 at 23:25 UTC ( [id://516797] : perlquestion . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    IF ($variable == 1 || $variable == 2 || $variable == 3) {
    ...
    IF ($vaiables == [1,2,3?????????
    
  2. or download this
    sub any {
      my $var = shift;
    ...
    }
    if (any($var,1..2000)) { print "Var is between 1 and 2000 inclusive\n"
    + }