Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Quicker way to compare these 2 strings?

by Anonymous Monk
on May 19, 2010 at 00:29 UTC ( #840588=note: print w/replies, xml ) Need Help??


in reply to Re: Quicker way to compare these 2 strings?
in thread Quicker way to compare these 2 strings?

Ok, with some minor corrections it works just fine!
Thanks!
$first= "AAAAXXXXAAAAXXXXXXXXXXXAAAA"; $second="AXXXAXXAAXXXXXAAAAXXXXXAAAA"; $matches=0; for $i (0..length($first)-1) { if (substr($first,$i,1) eq substr($second,$i,1)) { $matches++; } } print $matches."\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-09-26 19:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (118 votes). Check out past polls.

    Notices?