in reply to Re^2: Sorting by Date Help!
in thread Sorting by Date Help!
would the "Schwartzian Transform" link be the place to start?
Yes, I think so, as from there you'll also find a link to the original Unix Review column. The latter explains it in detail, but the PerlMonks thread provides additional discussion...
What isn't explained there is the specific implementation of the "expensive_func" being used here. So just in case :)
join('', (split(/\//, $_->{submitted}))[2,0,1] )
This splits the date strings by "/", rearranges the three parts so that year comes first, then month, then day (which makes the dates easily sortable by string comparison), and joins them into a single string like "080122" (for 01/22/08). The (...)[2,0,1] construct is described in perldata (search for "list slice").
|
|---|