Another possibility:
$count{$1}++ while $seq =~ /(?=(.{1}))/g; $count{$1}++ while $seq =~ /(?=(.{2}))/g; $count{$1}++ while $seq =~ /(?=(.{3}))/g;
Update: woops, added the (?=) I initially forgot.
In reply to Re: Question about speeding a regexp count
by ikegami
in thread Question about speeding a regexp count
by Commander Salamander
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |