Front page | perl.perl6.users |
Postings from January 2021
I need help with ~~m/
Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 30, 2021 06:24
Subject:
I need help with ~~m/
Message ID:
28ad5cf2-7add-a435-5346-04493ae2c4ab@zoho.com
Hi All,
rakudo-pkg-2020.12-01.x86_64
Why does this work?
> $x = "1.33.222.4";
1.33.222.4
> $x ~~ m/ (<:N>+) [.] (<:N>+) [.] (<:N>+) [.] (<:N>+) /;
「1.33.222.4」
0 => 「1」
1 => 「33」
2 => 「222」
3 => 「4」
But this does not?
--> Why the wrong number in $2?
--> Why no Nil for $3?
> $x = "1.33.222";
1.33.222
> $x ~~ m/ (<:N>+) [.] (<:N>+) [.] (<:N>+) [.] (<:N>+) /;
「1.33.222」
0 => 「1」
1 => 「33」
2 => 「2」
3 => 「2」
Yours in confusion,
-T
Thread Next
-
I need help with ~~m/
by ToddAndMargo via perl6-users