$c = 'qwertyasdf'; ($a, $b, @a) = sort map { $a = $_; ord chr grep $_ le $a, split //, $c } split //, $c; print "$a @a $b\n";