Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Perl6 Junctions

by mugwumpjism (Hermit)
on Jun 03, 2005 at 06:48 UTC ( [id://463133]=note: print w/replies, xml ) Need Help??


in reply to IF and some conditions

In perl 6, Junctions are a core language feature.

So, you could write:

say "OK" if ($test == any(7,5,3));

Thankfully someone has already implemented them for Perl 5, with the module on CPAN called Perl6::Junctions;

use Perl6::Junctions qw(any); print "OK\n" if ($test == any(7,5,3));

This is actually very similar to the Quantum::Superpositions answer above, and I believe the implementations share a common root.

$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://463133]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2024-04-23 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found