Hi Todd, first, please don't mix up the && Boolean operator and infix &, an *all* junction operator.
Also consider the difference between the following code snippets: > my$x="abcd"; if $x.contains(not "e") {say "y"}else{say "n"}; n > my$x="abcd"; if $x.contains(none "e") {say "y"}else{say "n"}; y Or between these: > my$x="abcd"; if $x.contains("b" & (not "d")) {say "y"}else{say "n"}; n > my$x="abcd"; if $x.contains("b" & (none "e")) {say "y"}else{say "n"}; y HTH, Laurent. Le mer. 19 déc. 2018 à 08:57, ToddAndMargo via perl6-users < perl6-users@perl.org> a écrit : > >> On Tue, Dec 18, 2018 at 10:49 PM ToddAndMargo via perl6-users > >> <perl6-users@perl.org <mailto:perl6-users@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 >