Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

The simplest way

by TheDamian (Priest)
on Apr 13, 2003 at 00:25 UTC ( #250099=note: print w/replies, xml ) Need Help??


in reply to Making a match

Previous respondents have suggested efficient ways for various circumstances. As for the simplest way:
use Quantum::Superpositions; if ($x == any(@list)) { ... }

Note that the latest release of Q::S (just uploaded to the CPAN last week) is iterator-based and therefore much more efficient that previous versions. We have Steven Lembark to thank for that.

Note too that, whilst the performance of the grep- and hash-based solutions may improve slightly over time, the any solution will continue to improve significantly with future releases of Quantum::Superpositions, then with the new Perl6::Junctions module, and ultimately with the availability of any as a built-in feature of Perl 6.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://250099]
help
Chatterbox?
[GotToBTru]: okay, I see what it does
[GotToBTru]: you;ve answered it .. the expression is meant to be evaluated as written, it is not a symbol for a special operation
[LanX]: '&;@' is a parsing error
[GotToBTru]: by itself, yes, but used in sub pre(&;@) not so
[LanX]: &; is interpreted as a function call, but the @ has no meaning
[LanX]: OH
[LanX]: you are talking about signatures?
[GotToBTru]: yes, it turns out I am
[LanX]: http://perldoc. perl.org/perlsub. html#Prototypes
[GotToBTru]: that page, strangely enough, never mentions that construct

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-01-18 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (164 votes). Check out past polls.