Skip to content

@avar /

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Find words that contain at least "msixpodual"
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Text::Table;
my @flags = split //, "msixpodual";
my %flags;
@flags{@flags} = ();
my %words;
while (my $word = <>) {
chomp $word;
my $cp = $word;
my $remaining = '';
my $score = 0;
for my $flag (@flags) {
if ($cp =~ s/$flag//i) {
} else {
$remaining .= $flag;
# Skip non-serious candidates
next if length($cp) > 0;
if ($score) {
$words{$word} = {
score => $score,
remaining => $remaining,
my @order = sort {
($words{$b}->{score} <=> $words{$a}->{score}) or
length($a) <=> length($a)
} keys %words;
my @tr;
for my $word (@order) {
push @tr => [
my $tb = Text::Table->new(
"Score", "Word", "Remaining"
print $tb;

Oops: length($a) <=> length($a)
(Not that it matters; if two words have the same score, then they have the same length as well. In fact, the score /is/ the length!)


There's a much improved version of this on perl5-porters now. This was just something I hacked up and is full of bugs and misfeatures :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.