Created
March 26, 2013 16:00
-
-
Save windytan/5246589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$|++; | |
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