substr isn't exactly cheap - depending on what you really want to do with a single character, a regular expression moving across the string might (or might not) be faster. See perlop and perlre for /gc.
while ($protein =~ /\G(.)/gc) { print $1; ... };
In reply to Re: Efficient walk/iterate along a string
by Corion
in thread Efficient walk/iterate along a string
by gje21c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |