my @data = ( 'test12-05-2003this', 'test11-05-2003this', 'test12-06-2003this', 'test12-05-2000this', ); @data = schwartzian(@data); print Dumper \@data; sub schwartzian { # do I *really* have to use strings here? :( my $result = [@_] ->map ('[$_,main::get_date($_)]') ->sort('$a->[1] <=> $b->[1]') ->map ('$_->[0]'); return @$result; } sub get_date { my ($month,$day,$year) = shift =~ /(\d+)-(\d+)-(\d+)/; return "$year$month$day"; }