develooper Front page | perl.perl6.users | Postings from January 2019

I need m/ help

Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 12, 2019 22:55
Subject:
I need m/ help
Message ID:
ca464cc4-4d94-3e08-eaea-43b53f960bb7@zoho.com
Hi All,

This works:

$ p6 'my $x="2018-09-15"; $x~~s/ (<:N>+) "-" (<:N>+) "-" (<:N>+) 
/$0.$1.$2/; say $x;'
2018.09.15


And this does too:

$ perl6 -e 'my Str $Date=DateTime.now.Str; $Date~~m/ (<:N>+) "-" (<:N>+) 
"-" (<:N>+) "T" .* /; print "$Date\n\t$0  $1  $2\n"'
2019-01-12T14:35:23.242587-08:00
	2019  01  12



But this does not.  What is wrong with (<:N>**2)  ?

$ perl6 -e 'my Str $Date=DateTime.now.Str; $Date~~m/ (<:N>**4) "-" 
(<:N>**2) "-" (<:Nl>**2) "T" .* /; print "$Date\n\t$0  $1  $2\n"'
Use of Nil in string context
   in block <unit> at -e line 1
Use of Nil in string context
   in block <unit> at -e line 1
Use of Nil in string context
   in block <unit> at -e line 1
2019-01-12T14:33:10.692302-08:00


Many thanks,
-T

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About