in reply to counting protein residues
This looks a lot like homework. If it is thought to be so and you have not been forthright in saying so, the quantity and quality of help offered may suffer. If you're new to Perl, maybe look at perlintro. (Update: There's also chromatic's free e-book download Modern Perl — highly recommended.)
Also, please understand that this is PerlMonks, not BioMonks. What's a "residue"? Could you give a Wikipedia link to a discussion of this topic? I assume it's possible to figure out the "number of residues in the helices" just by looking at the "--------HHHHHH-----HHHHHHHH------" string and knowing the number and context of each H; how about some info on this relationship?
Give a man a fish: <%-{-{-{-<
|
|---|