From 9c4f9eaf7ed81e259dde80a2f3ac050738cc7c60 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Fri, 1 Feb 2008 20:04:26 -0500 Subject: i really meant to be using shift here --- lib/Games/Word.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Games/Word.pm b/lib/Games/Word.pm index 93a0fd7..3aae86c 100644 --- a/lib/Games/Word.pm +++ b/lib/Games/Word.pm @@ -54,17 +54,17 @@ sub shared_letters { my @b = sort split //, shift; my @letters = (); - my ($a, $b) = (pop @a, pop @b); + my ($a, $b) = (shift @a, shift @b); while (defined $a && defined $b) { if ($a eq $b) { push @letters, $a; - ($a, $b) = (pop @a, pop @b); + ($a, $b) = (shift @a, shift @b); } elsif ($a lt $b) { - $a = pop @a; + $a = shift @a; } else { - $b = pop @b; + $b = shift @b; } } @@ -76,7 +76,7 @@ sub shared_letters_by_position { my @b = split //, shift; my @letters = (); - while (my ($a, $b) = (pop @a, pop @b)) { + while (my ($a, $b) = (shift @a, shift @b)) { last unless (defined $a && defined $b); if ($a eq $b) { push @letters, $a; -- cgit v1.2.3-54-g00ecf