On 06/12/2018 09:56 PM, ToddAndMargo wrote:
Hi All,

I am trying to turn

     01.02.03

into

     1.2.3

What am I doing wrong, this time?

$ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"'
  1 . 2 . 3


Many thanks,
-T




Got it:

$ p6 'my $x = "01.0.3.06.10"; say ($x.comb(/\d+/)>>.Int).join(".");'
1.0.3.6.10



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to