in reply to Re: sort timestamps with associated names.
in thread sort timestamps with associated names.

++ for a very informative answer. Have just been playing with Sort::Maker that will return a sub reference encapsulating any of the four types of sorting routines you ably demonstrated above. While it's not much savings for the plain case, you can alter your choice by changing one keyword:
use Sort::Maker; print make_sorter(qw/plain string substr($_,10)/)->(<DATA>); __DATA__ RRsnap02 2013-07-24 12:35:35 vmk000 2013-07-22 17:16:50 vmk001 2013-07-22 20:00:36 vmk009 2013-07-23 18:21:12 vmk010 2013-07-23 18:31:00 vmk020 2013-07-23 23:30:43 vmk024 2013-07-24 03:27:30 vmk031 2013-07-24 10:27:36 vmk032 2013-07-24 11:27:38 vmk032 2013-07-24 11:27:38
The generated code is straight forward:
sort { do{ my( $left, $right ) = map { substr($_,10) } $a, $b; $left cmp $right } } @_;
You could replace 'plain' with 'orcish', 'ST', or 'GRT' -- and for the ST case, the generated code is:
return map $_->[0], sort {$a->[1] cmp $b->[1]} map [ $_, do{ my ($val) = substr($_,10) ; $val } ], @_ ;