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

Re^2: simple string comparison for efficiency

by CaptainF (Initiate)
on May 29, 2009 at 00:16 UTC ( [id://766780]=note: print w/replies, xml ) Need Help??


in reply to Re: simple string comparison for efficiency
in thread simple string comparison for efficiency

Grandfather, your solution using bitwise operators would not have occurred to me, but was exactly what I needed. It solved the problem several orders of magnitude faster than my solution. Is there a simple way to extract the number of string positions where one or both strings had an 'N' from your code?

Replies are listed 'Best First'.
Re^3: simple string comparison for efficiency
by GrandFather (Saint) on May 29, 2009 at 01:15 UTC

    Add the line:

    my $nCount = ($mask1 =~ tr/N//) + ($mask2 =~ tr/N//);

    as the third line of sub match.


    True laziness is hard work

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-03-29 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found