in reply to Comparing a value to a list of numbers
well, for completeness:
There is smartmatch ~~ (sometimes) acting like an in operator
DB<24> $x=5 DB<25> p $x ~~ [1,2,5,6,9,10,41..56] 1 DB<26> $x=0 DB<27> p $x ~~ [1,2,5,6,9,10,41..56] DB<28>
but
WARNING: Smartmatch is experimental
so you'd need to deactivate the warning and hope it'll never vanish (at your risk)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Comparing a value to a list of numbers (in via smartmatch)
by Marshall (Canon) on Jan 30, 2021 at 02:27 UTC | |
by LanX (Saint) on Jan 30, 2021 at 02:32 UTC |
In Section
Seekers of Perl Wisdom