Based on your description I suspect that you are trying to compare DNA sequences, either at the level of a codon or translated to protein sequences. If that is the case, much more efficient and robust ways to do this are available. A more complete description of the problem would help.
Recommended next steps:
- Take a look at Bioperl
- Post more information about the problem. Don't be afraid to use a little biology or bioinformatics terminology, which will help the bio monks around here get a better understanding of the problem.