good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: need help comparing DNA complimentsby dakkar (Hermit) |
on Mar 17, 2003 at 17:26 UTC ( [id://243699]=note: print w/replies, xml ) | Need Help?? |
First, you are not comparing strings, you are comparing arrays. As this is not C, you don't need a for loop to get the length of an array: just say: Assigning an array to a scalar assigns the length of the array to the scalar (OK, we're talking about context here, but I'm not going into a detailed discussion) And your cycles are a bit out of whack... you are saying:
I'll not write here a "correct" solution, since many other people already have. I'll just write a (commented) snippet for the case of strings:
-- dakkar - Mobilis in mobile
In Section
Seekers of Perl Wisdom
|
|