Skip to content

Instantly share code, notes, and snippets.

@windytan windytan/deco.pl
Created Mar 26, 2013

Embed
What would you like to do?
$|++;
use warnings;
use Text::LevenshteinXS qw(distance);
for (qx!cat nappis.txt!) {
$merkki{$2} = $1 if (/^(.+) ([01]+)/);
}
while (<>) {
chomp();
$pienin = "";
for $vertai (keys %merkki) {
$pienin = $vertai if ($pienin eq "" or distance($_, $vertai) <= distance($_, $pienin));
}
print ($merkki{$pienin} // "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.