[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: delimiters with more than one character?



On Thu, Jul 16, 2020 at 12:03 PM Nicolas George wrote:
>
> Observe your output carefully. You'll notice that the string you defined
> does not actually contain any backslash.
>
> Regards,
>
>   Nicolas George

Thank you, Nicholas!

Looks like the trick for Raku one-liners on the bash command line is to use single quotes on the outside, and one of Raku's quoting-language constructs (Q[ ... ], known as the Raku 'literal string' construct) on the inside. Note splitting on the two-character "\|" delimiter in the second (final) statement:

user@mbook:~$ raku -e 'my Str $s= Q[ 34 + 45 \| abc \| 1 2 3 \| c\|123abc ]; .raku.put for $s.split( Q[\|] );'
" 34 + 45 "
" abc "
" 1 2 3 "
" c"
"123abc "
user@mbook:~$

Reference: "The Q Lang"
https://docs.raku.org/language/quoting

HTH, Bill.

Reply to: