On 12/11/23 14:47, Andy Bach wrote:
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,
a bug in say.
From: ToddAndMargo via perl6-users
Sent: Monday, December 11, 2023 3:24 PM
To: perl6-users@perl.org
Subject: Re: .contains question
CAUTION - EXTERNAL:
> "so" will collapse the junction into a Bool.
> "say" will append a \n for
"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
wrote:
On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
wrote:
Hi All,
my Str $x="abc3defg"; if $x.contains( "a" || "b" ||
my $x="abc45def";
my @y=; say so $x.contains(any @y);
"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
> wrote:
>
>>> On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
>>> wrote:
On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
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
my @letters = ;
if $x.contains(any @letters) {
...
> On 10 Dec 2023, at 21:36, ToddAndMargo via perl6-users
> 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
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?
Yup, you can use it as a method call like this:
perl6 -e '"foobar".&[~~](/foo/).say'
「foo」
HTH
- Timo
On Mon, Jun 12, 2017 at 4:07 PM, Elizabeth Mattijsen wrote:
>> On 12 Jun 2017, at 22:04, Will Coleda wrote:
>> On Mon, Jun 12, 2017 at 5:17 AM, Francesco Rivetti wrote:
>>> if you can:
>>>
>>> $s ~~ "foo"
>>> $s ~~ /foo/
>>>
>>> then wouldn't be
On Mon, Jun 12, 2017 at 5:17 AM, Francesco Rivetti wrote:
> if you can:
>
> $s ~~ "foo"
> $s ~~ /foo/
>
> then wouldn't be good to have also:
>
> $s.contains("foo");
> $s.contains(/foo/);
The latter is currently available as:
> "foobar".match(/'foo'/);
「foo」
> IOW, overload
On 06/12/2017 01:42 AM, Elizabeth Mattijsen wrote:
On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else {say
"in"}'
Would this be easier to do with $x.contains? Or would it
be too worky?
.contains
Thinking about this...
> On 12 Jun 2017, at 11:17, Francesco Rivetti wrote:
>
> if you can:
>
> $s ~~ "foo"
> $s ~~ /foo/
>
> then wouldn't be good to have also:
>
> $s.contains("foo");
> $s.contains(/foo/);
>
> IOW, overload .contains() with Str and Regex
>
> F
>
> On
if you can:
$s ~~ "foo"
$s ~~ /foo/
then wouldn't be good to have also:
$s.contains("foo");
$s.contains(/foo/);
IOW, overload .contains() with Str and Regex
F
On 06/12/2017 10:42 AM, Elizabeth Mattijsen wrote:
On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
perl6 -e
> On 12 Jun 2017, at 01:27, ToddAndMargo wrote:
> perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else {say
> "in"}'
>
> Would this be easier to do with $x.contains? Or would it
> be too worky?
.contains only takes a *single string* to look up. So
Hi All,
perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else
{say "in"}'
Would this be easier to do with $x.contains? Or would it
be too worky?
Many thanks,
-T
15 matches
Mail list logo