Permalink
Browse files

fix #120517, Str:D:.words returns the one elem if it is just one

This way .perl on it looks a bit nicer.
  • Loading branch information...
1 parent b11094e commit 9dfecb8991faefa488ad4fbd55bd188943e70fea @FROGGS FROGGS committed Nov 12, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/core/Str.pm
View
@@ -800,7 +800,8 @@ my class Str does Stringy { # declared in BOOTSTRAP
}
method words(Str:D: $limit = *) {
- self.comb( / \S+ /, $limit );
+ my @chunks := self.comb( / \S+ /, $limit );
+ +@chunks == 1 ?? @chunks[0] !! @chunks
}
my %enc_type = utf8 => utf8, utf16 => utf16, utf32 => utf32;

0 comments on commit 9dfecb8

Please sign in to comment.