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