Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Pair of items

by Anonymous Monk
on Jul 30, 2003 at 16:09 UTC ( #279231=note: print w/replies, xml ) Need Help??


in reply to Re: Pair of items
in thread Pair of items

Quantum::Superpositions offers an elegant solution:
use Quantum::Superpositions; my $list1 = [1,2,3]; my $list2 = [4,5,6]; print "No common items" if all(@$list1) != all(@$list2);
Basically, if all of the elements in list1 are not equal to all of the elements in list2, that will print "No Common Items"

HTH

-Tom

Replies are listed 'Best First'.
Re3: Pair of items
by dragonchild (Archbishop) on Jul 30, 2003 at 16:27 UTC
    And, that is the solution I would propose in Perl6.

    However, Quantum::Superpositions is not a core module nor is it meant to be used in production code. It's a plaything conceived in the bowels of TheDamian's mind that hasn't been thoroughly tested. *shrugs* TMTOWDI

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2023-02-05 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?