File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -537,8 +537,8 @@ Examples:
537
537
538
538
= head2 routine words
539
539
540
- multi sub words(Str:D $input, $ limit = Inf --> Seq )
541
- multi method words(Str:D $input: $limit = Inf --> Seq )
540
+ multi method words(Str:D: $ limit)
541
+ multi method words(Str:D: )
542
542
543
543
Returns a list of non-whitespace bits, i.e. the same as a call to
544
544
C < $input.comb( / \S+ /, $limit ) > would.
@@ -550,6 +550,14 @@ Examples:
550
550
say "foo:bar".words.perl; # OUTPUT: «("foo:bar",).Seq»
551
551
say "foo:bar\tbaz".words.perl; # OUTPUT: «("foo:bar", "baz").Seq»
552
552
553
+ As can be seen by the definition, it can also be used as a subroutine, turning
554
+ the first argument into the invocant. C < $limit > is optional, but if it is
555
+ provided (and not equal to C < Inf > ), it will return only the first C < $limit >
556
+ words.
557
+
558
+ say words("I will be very brief here",2); # OUTPUT: «(I will)»
559
+
560
+
553
561
= head2 routine flip
554
562
555
563
multi sub flip(Str:D --> Str:D)
You can’t perform that action at this time.
0 commit comments