Re: Test not working so well

[email protected] (William Michels via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
> On 12/9/23 17:44, Tom Browder wrote:
> > Try: say so $=....
> >
> 
> Would you give me a quick example?

Hi Todd!

In the Raku REPL (MoarVM 2023.05):

[0] > my $x="abc2def"; say  $x ~~ / ^ <alnum> ** 7 $ /;
「abc2def」
 alnum => 「a」
 alnum => 「b」
 alnum => 「c」
 alnum => 「2」
 alnum => 「d」
 alnum => 「e」
 alnum => 「f」
[0] > my $x="abc2def"; .so.put if  $x ~~ / ^ <alnum> ** 7 $ /;
False
[0] > my $x="abc2def";   $x ~~ / ^ <alnum> ** 7 $ /.so;
True
[1] > my $x="abc2def";   ($x ~~ / ^ <alnum> ** 7 $ /).so;
True
[2] > my $x="abc2def";   Bool($x ~~ / ^ <alnum> ** 7 $ /);
True
[3] > my $x="abc2def";   Bool($x ~~ / ^ <alnum> ** 8 $ /);
False
[4] > my $x="abc2def";   Bool($x ~~ / ^ <alnum> ** 7 $ /).say;
True
[4] > my $x="abc2def";   Bool($x ~~ / ^ <alnum> ** 8 $ /).say;
False
[4] > my $x="abc2def";   Bool($x ~~ / ^ <[0..9] + [a..z]> ** 7 $ /).say;
True
[4] > my $x="abc2def";   Bool($x ~~ / ^ <[0..9] + [a..z]> ** 8 $ /).say;
False
[4] > my $x="abc2def";   Bool($x ~~ / ^ <+[0..9] + [a..z]> ** 8 $ /).say;
False
[4] > my $x="abc2def";   say so $x.match: / ^ <+[0..9] + [a..z]> ** 8 $ /;
False
[4] > my $x="abc2def";   say so $x.match: / ^ <+[0..9] + [a..z]> ** 7 $ /;
True
[4] >


HTH, Bill.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.