Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Finding wether all elements of one array are in another

by pKai (Priest)
on Mar 31, 2006 at 11:47 UTC ( #540434=note: print w/replies, xml ) Need Help??

in reply to Finding wether all elements of one array are in another

use strict; use warnings; my @a = qw(-true -depth=1); my @b = qw(-search -depth=1 -true -expand_all); print '@b contains @a' if @a == grep defined, @{{map {$_=>$_} @b}}{@a} +;

O. K., I'm not too serious about proposing this. Though it meets my sense of elegance (somehow).

Also note that no counting takes place: If an element appears more than once in @a they will be covered by a single (identical) entry in @b for acknowledging their containment.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://540434]
Eily the verb from this sentence
[LanX]: jdporter adjusted the best nodes algorithm not long ago to public demands, my theory more complicated= more error prone
[Eily]: what error? I see no issue :P
LanX and: = harder to reproduce. ..
[LanX]: sorry, i didn't break math yet, but it's top priority on my todo list

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2018-03-20 10:18 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (249 votes). Check out past polls.