Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub to_sortable {
- my $date = shift;
- $date =~ /(\d{2})-(\d{2})-(\d{4})/;
- return $3.$1.$2;
- }
- my @out = sort { to_sortable($b) cmp to_sortable($a) } ("01-05-2016", "05-08-2016", "07-09-2015", "02-24-2014", "09-30-2012", "01-09-2017");
- print join ", ", @out;
- print "\n";
Advertisement
Add Comment
Please, Sign In to add comment