Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix failure in event001-eric256
Using `split('')` to get the individual elements of a number or string is
a Perl 5-like way of doing this.  Unfortunately, `split` matches the empty
string at the *ends* of the string as well, hence one gets 9 elements from a
7 digit string.  The solution is to use `comb`, which is the correct way to
do this in Perl 6.
  • Loading branch information
Paul Cochrane committed Aug 28, 2015
1 parent 115ad18 commit 4e3e0eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion categories/wsg/advanced-2008/event001-eric256.pl
Expand Up @@ -130,7 +130,7 @@ (Bool :$verbose = False)
my $phone_number = 7323464;
my @test_words;

for $phone_number.split('') {
for $phone_number.comb {
say $_, "->", %digits{$_}.join('-') if $verbose;
if (@test_words.elems) {
my @values = %digits{$_}.values;
Expand Down

0 comments on commit 4e3e0eb

Please sign in to comment.