Blob
1 #!/usr/bin/perl3 # Using the glob operator, a naive sort of every name in your home directory4 # by their relative sizes might be written as:5 #6 # chdir; # the default is our home directory;7 # my @sorted = sort { -s $a <=> -s $b } glob '*';8 #9 # Rewrite this using the Schwartzian Transform technique.11 use v5.24;12 use warnings;13 use strict;14 use utf8;16 chdir;17 my @sorted = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, -s] } glob '*';18 print join "\n", @sorted;