http://www.perlmonks.org?node_id=1042078


in reply to Bioinformatics project feedback request.

How long are your strings going to be? If they are going to be huge (e.g., in the gigabytes), you will want to pass around references to the string to your subroutines. E.g.:
sub bp_count { my ($data) = @_; # obtain the count of each nucleotide in the sequence my $a_count = ($$data =~ tr/Aa//); my $c_count = ($$data =~ tr/Cc//); my $g_count = ($$data =~ tr/Gg//); my $t_count = ($$data =~ tr/Tt//); return ($a_count, $c_count, $g_count, $t_count); } # Called with: bp_count(\$string);