in reply to sort based on last and first value

As a one-liner:

print values { map { (/\/(\d+)\./)[0] => $_ } sort <DATA> };

Replies are listed 'Best First'.
Re^2: sort based on last and first value
by soonix (Chancellor) on Aug 27, 2013 at 09:47 UTC
    just as I was arduously composing this, which does roughly the same:
    my %latest; for (sort <INFO>) { # by date my ($date, $path) = split "/", $_, 2; # assuming these are compl +ete paths $latest{$path} = $_; # newer overwrites older } # output ordered by "path" values print $latest{$_} for sort keys %latest;