Skip to content

Instantly share code, notes, and snippets.

@Altreus
Created September 4, 2015 11:24
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 Altreus/e42c1ae6da2164bef85e to your computer and use it in GitHub Desktop.
Save Altreus/e42c1ae6da2164bef85e to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;
my $letters = lc sort_letters(shift);
my $dict = shift // '/usr/share/dict/words';
open my $words_in, '<', $dict;
while (<$words_in>) {
say if lc(sort_letters($_)) eq $letters;
}
sub sort_letters {
my $letters = shift;
return join '', sort split //, $letters;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment