in reply to Comparing a value to a list of numbers
Depending on your requirements on time and memory complexity, you could also use a hash
DB<28> %in = map { $_ => 1 } 1,2,5,6,9,10,41..56 DB<29> p $in{5} 1 DB<30> p $in{0} DB<31>
corrected C&P error omitting the 1
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|