Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created September 9, 2012 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ynonp/3684778 to your computer and use it in GitHub Desktop.
Save ynonp/3684778 to your computer and use it in GitHub Desktop.
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