you can use grep like in if grep{ $given == $_ } @nums or any from List::Util
Anyway what you posted is not perl: the equal sign = is an assignement operator and you need == to compare nums and eq for strings. if must be lowercase and square brackets are for anonymous arrays.
L*
In reply to Re: Comparing a value to a list of numbers
by Discipulus
in thread Comparing a value to a list of numbers
by g_speran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |