Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: simple string comparison for efficiency

by CaptainF (Initiate)
on May 29, 2009 at 00:16 UTC ( #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?
  • Comment on Re^2: simple string comparison for efficiency

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
Node Status?
node history
Node Type: note [id://766780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-06-20 17:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (95 votes). Check out past polls.

    Notices?