From 81331da338fd27d03b2c34aa5bf721e69dabea2d Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 1 Feb 2008 19:54:05 -0500 Subject: stop looping once we go off the end of one of the strings --- lib/Games/Word.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Games/Word.pm b/lib/Games/Word.pm index 948828e..93a0fd7 100644 --- a/lib/Games/Word.pm +++ b/lib/Games/Word.pm @@ -77,6 +77,7 @@ sub shared_letters_by_position { my @letters = (); while (my ($a, $b) = (pop @a, pop @b)) { + last unless (defined $a && defined $b); if ($a eq $b) { push @letters, $a; } -- cgit v1.2.3-54-g00ecf