develooper Front page | perl.perl6.users | Postings from June 2018

How do I remove leading zeros?

Thread Next
From:
ToddAndMargo
Date:
June 13, 2018 04:57
Subject:
How do I remove leading zeros?
Message ID:
c5c8400d-83bd-dd73-91a6-ae96ff4509fb@zoho.com
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


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we ask for advice, we are usually looking for an accomplice.
    --  Charles Varlet de La Grange
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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