in reply to What is sprintf doing?

I think your question was answered above. Just a minor and irrelevant style consideration I wanted to raise.

Tasks which munge lists into other lists might be more readable if you consider them to be a pipeline. You could get lost in all those curly braces if they keep chaining like that. Each task on the pipeline becomes clear if you line them up a bit:

my @sorted = map { substr $_, 5 } sort { $b cmp $a } map { sprintf '%05d%s', $_ =~ m[,\s+(\d+)], $_ } @msgs;

--
[ e d @ h a l l e y . c c ]