> I have found that when using `say` for debugging, it has been known to print > out the > previous value of a variable and not the current value. `print` does not do > this.
That would certainly be a surprise to me. I'd think I was misunderstanding my program, rather than a bug in say. ________________________________ From: ToddAndMargo via perl6-users <perl6-us...@perl.org> Sent: Monday, December 11, 2023 3:24 PM To: perl6-us...@perl.org <perl6-us...@perl.org> Subject: Re: .contains question CAUTION - EXTERNAL: > "so" will collapse the junction into a Bool. > "say" will append a \n for you, so you don't have to. > >> On 11 Dec 2023, at 01:52, ToddAndMargo via perl6-users >> <perl6-us...@perl.org> wrote: >> >>>> On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users >>>> <perl6-us...@perl.org> wrote: >>>> >>>> Hi All, >>>> >>>> my Str $x="abc3defg"; if $x.contains( "a" || "b" || "3" ) { print >>>> "True\n"; } else { print "False\n" }; >>>> True >>>> >>>> Is there a way to tell .contains that you want to know >>>> if any of a sequence characters is in a string other that >>>> repeating || over and over. Any [a..z] or [0..9] option? >>>> >>>> Many thanks, >>>> -T >> >> On 12/10/23 15:24, Elizabeth Mattijsen wrote: >>> my @letters = <a b 3>; >>> if $x.contains(any @letters) { >> >> >> Hi Elizabeth, >> >> Very interesting. Problem: I was looking for one answer, not many >> >>> my $x="abc45def";my @y=<a b c d e f g h i j 1 2 3 4 5>; print >>> $x.contains(any @y) ~ "\n"; >> True >> True >> True >> True >> True >> True >> False >> False >> False >> False >> False >> False >> False >> True >> True On 12/11/23 01:11, Elizabeth Mattijsen wrote: > my $x="abc45def"; > my @y=<a b c d e f g h i j 1 2 3 4 5>; say so $x.contains(any @y); Hi Elizabeth, Awesome! Thank you! I usually stay away from `say` as in my longer programs, I have found that when using `say` for debugging, it has been known to print out the previous value of a variable and not the current value. `print` does not do this. This is why you see me using `print` so often. And I can type, so the extra finger motions do not bother me. Capitol letter also do not for the same reason. Some tests! my $x="abc45def"; my @y=<a b c d e f g h i j 1 2 3 4 5>; say so $x.contains(any @y); True my $x="abc45def"; my @y=<g h i j 1 2 3 7 8>; say so $x.contains(any @y); False my $x="abc45def"; my @y=<g h i j 1 2 3 4 5>; say so $x.contains(any @y); True my $x="abc45def"; my @y=<g h i j 1 2 3 7 8>; say so $x.contains(any @y); False Oh now I am really pushing it with these (note the `all` in the second one)! my $x="abc45def"; say so $x.contains(any <g h i j 1 2 3 7 8>); my $x="abc45def"; say so $x.contains(all <g h i j 1 2 3 7 8>); False my $x="abc45def"; say so $x.contains(any <a b c d e f g h i j 1 2 3 4 5>); True -T CAUTION - EXTERNAL EMAIL: This email originated outside the Judiciary. Exercise caution when opening attachments or clicking on links.