Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Print files by length
use v5.14;
my %files = map { length($_) => $_ } glob('*');
my $count = shift;
foreach my $length (sort {$a <=> $b} keys %files) {
say $files{$length};
--$count or last;
say join("\n", map /^\d+ (.*)/, (sort {$a <=> $b} map { length($_) . " $_" } glob('*'))[0..(shift)-1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment