Re: `lines.contains( / \h / )` returning True for input strings not containing horizonal whitespace

[email protected] (William Michels via perl6-users)
Newsgroups perl.perl6.users
Message-ID <CAA99HCy3t+FdNqKmzbzPR-ADA4h4eF0xzCPz3mgVo9c6MzAyGQ@mail.gmail.com>
Thanks Sean.

Made some progress. I like this result better:

~$ raku -e 'put "1\n2\n3";' | raku -e 'lines.map(*.contains(/ \h /)).put;'
False False False

Thx, Bill.

On Thu, Jan 26, 2023 at 12:12 PM Sean McAfee <[email protected]> wrote:

> On Thu, Jan 26, 2023 at 12:05 PM William Michels via perl6-users <
> [email protected]> wrote:
>
>> ~$ raku -e 'put "1\n2\n3";' | raku -e 'put lines.contains(/ \h /) ?? True
>> !! False;'
>> True
>>
>
> lines() returns a Seq.  The contains method for a Seq coerces its argument
> to a Str and calls contains on that Str.  And:
>
> $ raku -e 'put "1\n2\n3"' | raku -e 'put lines.Str'
> 1 2 3
>
> There's your horizontal whitespace.
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.