Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: *IN* Operator for the Perl wish list

by lidden (Curate)
on Mar 30, 2007 at 12:49 UTC ( [id://607466] : note . print w/replies, xml ) Need Help??


in reply to *IN* Operator for the Perl wish list

In Perl 6 you will be able to do:
if $value == 1 | 5 | 21 | 99 { ...
or
if $value == any( 1, 5, 21, 99) { ...

Replies are listed 'Best First'.
Re^2: *IN* Operator for the Perl wish list
by grinder (Bishop) on Mar 30, 2007 at 15:15 UTC
    In Perl 6 you will be able to...

    And before that comes out (*ducks*), you'll be able use smart matching in perl 5.10:

    use 5.9.5; my $var = shift; my @f = (1,2,3,5,8,13,21); print "fibo!" if $var ~~ @f;

    • another intruder with the mooring in the heart of the Perl