Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by ahmad (Hermit)
on Dec 15, 2005 at 20:50 UTC ( [id://517079] : note . print w/replies, xml ) Need Help??


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

it depends on what you're going to do after knowing if it's equal to or not , This may help

my @array = qw/1 2 3 4/; my $matched; foreach (@array){ if($variable == $_){ $matched = $_;} }

it's not the best way but it may be helpful i think