aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-208/bob-lied/perl/ch-1.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-208/bob-lied/perl/ch-1.pl b/challenge-208/bob-lied/perl/ch-1.pl
index b62e9e0927..a62f12156f 100644
--- a/challenge-208/bob-lied/perl/ch-1.pl
+++ b/challenge-208/bob-lied/perl/ch-1.pl
@@ -64,9 +64,9 @@ sub asHash($list)
my %h;
# If there are duplicate values in the list, we want to
# retain only the first, lesser, index.
- for my $i ( 0 .. $#{$list} )
+ while ( my ($i, $val) = each @$list )
{
- $h{$list->[$i]} = $i unless exists $h{$list->[$i]};
+ $h{$val} = $i unless exists $h{$val};
}
return \%h;
}