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

robsv has asked for the wisdom of the Perl Monks concerning the following question:

I am calling an external routine which returns a string containing 2, 3, or 4 letters in the order in which they are read. I need to sort this string before outputting it. For example, if $bases = 'GCT', I need to change $bases to 'CGT' (the fine print: I'm playing with DNA, so the alphabet is 'ATCGN'). I'm currently doing this:
$bases = join '',sort split('',$bases);
...which seems like a bit of overkill if the string will always be 2-4 characters. Since There's More Than One Way To Do It, I was wondering what other ways there were to do it. (This isn't meant to be a Golf question, but golfers are welcome!)

- robsv