Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Find characters in ALL strings

by Roy Johnson (Monsignor)
on Sep 20, 2007 at 20:28 UTC ( [id://640228]=note: print w/replies, xml ) Need Help??


in reply to Find characters in ALL strings

If there's some character you can guarantee is not in the strings (so that you can use as a separator — I chose space), you could do
my @common = (join ' ', @s) =~ /(.)(?=(?:.* .*\1){$#s})/g;
Not really elegant; I just thought it was a nifty one-liner.

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

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

    No recent polls found