in reply to Help Manipulating Sort with Subroutines

If I understand correctly, you want to sort by increasing number of "G" and "C"s.

How can you compare letter counts if you only have one count? The callback is called a number of times to compare two items to be sorted. The To sort based on the number of "G"s and "C"s of items, you'll have to count the number of "G"s and "C"s in both items and compare those counts.

my @sorted = sort { my $count_a = $a =~ tr/GC//; my $count_b = $b =~ tr/GC//; $count_a <=> $count_b } @sequences;

That should do in almost all circumstances. If you're dealing with massive amount of data, the following optimisation might help:

my @sorted = map substr($_, 4), sort map pack('N', tr/GC//) . $_, @sequences;