in reply to Re: Reg Expression Question
in thread Reg Expression Question
Well, no ... $i =~ /[0|5|8|15|20]/;matches one character which is either 0, 1, 2, 5, 8 or |. And only if you correct the typo ;-)
What you can do is use parenthesis like this $i =~ /^(0|5|8|15|20)$/; but make sure you have the start and end of string assertions, otherwise you will match much more numbers.
Apart from that I think a hash would be a better solution as already mentioned elsewhere.
-- Hofmator
|
|---|