summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-02-01 20:04:26 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-02-01 20:04:26 -0500
commit9c4f9eaf7ed81e259dde80a2f3ac050738cc7c60 (patch)
tree4856ab3661bd5f03149b4f5651418b2230b1ec79
parent2a0658a330bce91f8efddbee365d232c2401a530 (diff)
downloadgames-word-9c4f9eaf7ed81e259dde80a2f3ac050738cc7c60.tar.gz
games-word-9c4f9eaf7ed81e259dde80a2f3ac050738cc7c60.zip
i really meant to be using shift here
-rw-r--r--lib/Games/Word.pm10
1 files 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;