Your book ran the loop backwards to reverse the string. You can run it forward, but you must reverse the concatenation:
$complement = $base . $complement;
In reply to Re: Trying to use substring to find a reverse complement in DNA,
by BillKSmith
in thread Trying to use substring to find a reverse complement in DNA,
by tryingnottofailmytes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |