On Tue, Dec 18, 2018 at 10:49 PM ToddAndMargo via perl6-users
<perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
Hi All,
Where is my booboo?
$ p6 'my$x="abcd"; if $x.contains("b" && not "q") {say "y"}else{say
"n"};'
n
In the mean time, I will ue
if $x.contains("b") && not $x.contains( "q" )
Many thanks,
-T
On 12/18/18 4:13 PM, Ralph Mellor wrote:
.contains tests whether its invocant, treated as a string, contains its
argument, treated as a string.
The argument you've given to .contains is:
"b" && not "q".
That's not a string.
Here's one option:
my$x="abcd"; if $x.contains("b") && not $x.contains("q") {say
"y"}else{say "n"};
Hi Ralph,
That was my work around.
The reason I asked the question was the following:
$ p6 'my$x="abcd"; if $x.contains("b" & "d") {say "y"}else{say "n"};'
y
$ p6 'my$x="abcd"; if $x.contains("b" & "e") {say "y"}else{say "n"};'
n
So it seemed to me that the following should also work, which
it does not:
Should be "y"
$ p6 'my$x="abcd"; if $x.contains("b" & not "e") {say "y"}else{say "n"};'
n
Should be "n" and it is
$ p6 'my$x="abcd"; if $x.contains("b" & not "d") {say "y"}else{say "n"};'
n
I think maybe I am pushing the limits. Perl has 101 way of
doing everything. It think I am pushing 102.
-T