`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 <CAA99HCzajj8XXGZp1ANSzfaQvvvaYYPhbao+cgqeFSLnow=LvA@mail.gmail.com>
Hi, I'm seeing an issue where I try to write parallel code between `slurp`
and `lines`, expecting that when I feed each one-liner a string with
vertical whitespace (but not horizontal whitespace), the two methods will
be differentiated--since lines autochomps by default.

~$ raku -e 'put "1\n2\n3";' | raku -e 'put slurp.contains(/ \h /) ?? True
!! False;'
False
~$ raku -e 'put "1\n2\n3";' | raku -e 'put lines.contains(/ \h /) ?? True
!! False;'
True

However, my 'control case' (second example above) is showing that a string
devoid of apparent whitespace is coming up positive, i.e. returning True. I
would think this is a 'trap for the unwary', if it is indeed the specified
behavior.

Comments/feedback welcome and appreciated.
FYI I'm on Rakudo™ v2022.07.

Thx, Bill.
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.