Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Looking for function similer to member() in SKILL

by redhotpenguin (Deacon)
on Jun 21, 2005 at 09:11 UTC ( [id://468604]=note: print w/replies, xml ) Need Help??


in reply to Re: Looking for function similer to member() in SKILL
in thread Looking for function similer to member() in SKILL

That's a very cool way of solving this problem, I learned quite a bit from reading it. I noticed that this returns lines that contain at least one element in @arr. I made a simple modification to the second algorithm to only return lines that have all elements in @arr. The OP didn't specify if he meant one or all array elements, so here's my modification for brevity's sake.

my (%hsh, @keepers); @hsh{@arr} = (); while (<>) { push @keepers, $_ unless grep {!exists $hsh{$_}} split; }
Thanks for enlightening me with that code sample Zaxo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-20 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found