Could you just create two arrays, @comp1 and @comp2 . Then run a foreach loop for every char in the string and push @comp1, @char_from_a, do the same for $b, and then foreach pop out the front see whether they compare?
-Dan On Fri, 2003-09-19 at 00:47, Jian Kang wrote: > I got a problem of finding the difference of two > bit(binary) strings, > > eg: > $a = "01"; > $b = "11"; > > differs by: 1 > > Is there a good way to solve this when $a and $b are > very long, like: > $a = "000000111010011000011110000110010" > $b = "111011010101111100001110010010010" > > I used 'vec' function to extract each bit and compare, > the code is really ugly, please, if you have some > better idea. Thanks. > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]