use warnings; use strict; my $s = 'hello'; my $x = join '', sort split //, $s; print "$x\n"; __END__ ehllo