You can use tail:
$ perl6 -e 'say .words.tail(2)'
(bar bat)
On Saturday, April 14, yary wrote:
> What's an elegant way of asking for the last two words? I have this:
>
> 'foo bar bat'.words[*-2..*];# (bar bat)
>
> I bet it could be better...
>
> -y
>
> On Sat, Apr 14, 2018 at 3:23 AM, JJ
What's an elegant way of asking for the last two words? I have this:
'foo bar bat'.words[*-2..*];# (bar bat)
I bet it could be better...
-y
On Sat, Apr 14, 2018 at 3:23 AM, JJ Merelo wrote:
>
>
> 2018-04-14 7:27 GMT+02:00 ToddAndMargo :
>
>> Hi All,
>>
>> I am over on
>> https://docs.
2018-04-14 7:27 GMT+02:00 ToddAndMargo :
> Hi All,
>
> I am over on
> https://docs.perl6.org/routine/words
> and I can't make heads of tails out of it.
>
Can you please report that as an issue in
https://github.com/perl6/doc/issues?
Cheers
JJ
"words" is just a shorthand for a common invocation of "split", really.
On Sat, Apr 14, 2018 at 1:27 AM, ToddAndMargo wrote:
> Hi All,
>
> I am over on
> https://docs.perl6.org/routine/words
> and I can't make heads of tails out of it.
>
> Do
org/routine/words
> and I can't make heads of tails out of it.
>
> Does "words" have a delimiter, as does "-F" with awk?
>
> Many thanks,
> -T
>
Hi All,
I am over on
https://docs.perl6.org/routine/words
and I can't make heads of tails out of it.
Does "words" have a delimiter, as does "-F" with awk?
Many thanks,
-T