in reply to Iterating over string

Not sure if it is quicker, it will depend on volumes, but you could Benchmark using a hash and RE:
my $string = 'ALL CHANGE, THOSE GOING TO ASCOT'; my %hash; while ($string =~ /([AGCT])/g) { $hash{$1}++ } local $, = ' '; print %hash,"\n";


By the way, don't use switch/case, it is buggy and deprecated. Use given/when instead.