Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Efficient code.

by merlyn (Sage)
on Jan 30, 2006 at 17:44 UTC ( #526501=note: print w/replies, xml ) Need Help??


in reply to Efficient code.

It's not clear from the context, but are you just looking for set intersection? I mean, if the comparison is merely "is this line of B also a line in A in its entirety", then the problem is trivial:
open A, "a" or die; my %in_a = map { $_, 1 } <A>; open B, "b" or die; while (<B>) { print if $in_a{$_}; }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://526501]
help
Chatterbox?
[Lady_Aleena]: james28909, I put it at the top of my scratchpad, if you want to look at it.
[Lady_Aleena]: I remember being pretty proud of that little sub when I wrote it.
[james28909]: oh xD
[james28909]: i see the predicament here.
[james28909]: maybe rename it to 'query'

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-05-24 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?