summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 23:35:46 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 23:35:46 -0500
commitfb30d9468ff23430b7e282fae858752480fe61d2 (patch)
tree37f605b04ad5217cbff10fbf81f9ce994f45bd3e
parentadd00b94fa61ee11589a73b6de43c2ae6beb48e2 (diff)
downloadgames-word-fb30d9468ff23430b7e282fae858752480fe61d2.tar.gz
games-word-fb30d9468ff23430b7e282fae858752480fe61d2.zip
shared_letters_by_position should return an array that's the length of the longer string, not the shorter
-rw-r--r--lib/Games/Word.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Games/Word.pm b/lib/Games/Word.pm
index b64af08..6bc9b37 100644
--- a/lib/Games/Word.pm
+++ b/lib/Games/Word.pm
@@ -154,8 +154,8 @@ sub shared_letters_by_position {
my @letters = ();
while (my ($a, $b) = (shift @a, shift @b)) {
- last unless (defined $a && defined $b);
- if ($a eq $b) {
+ last unless (defined $a || defined $b);
+ if (defined $a && defined $b && $a eq $b) {
push @letters, $a;
}
else {