http://www.perlmonks.org?node_id=1045598

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi.

I was looking at a article that MJD wrote regarding the Schwartzian Transform and I simply wanted make sure I was interpreting (pun intended) the mechanism correctly:

@sorted_names = map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $_, -M $_ ] } readdir D;

Reading from the bottom up, I think perl: Reads the 'D' directory, builds an anonymous array containing the name of the file and its associated size in bytes which is then converted to a list(?) by map before the aforementioned items are sorted in reverse order. The top most map operation is slightly confusing since it appears to be doing something with the first element of the list before placing the sorted items in the array. Am I close to understanding it? Is the Schwartzian Transform *always* constructed in this manner?

Thanks everyone.