in reply to checking an array of numbers for a particular value
Hi, Try this
@array=qw/2 3 7 5 34/; $no=13; if(grep {$_ == $no} @array) { print "Condition true"; } else { print "Condition false"; }
Here I have a array @array, which contains the list of allowed values. $no should be the number you want to check.
|
|---|