#!/usr/bin/perl use strict; use warnings; use 5.014; print map {$_->[0]} sort {$b->[1] cmp $a->[1] || $a->[2] cmp $b->[2]} map {[ $_, unpack "a8a6", $_ ]} ; __DATA__ 20010405000000 20050405005000 20020405081200 20080405022500 20080405022600 20080405023500 20090405022500 20090405022300 20090405022900 20090405022100