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

Re: How do I remove leading zeros?

Thread Previous | Thread Next
From:
Larry Wall
Date:
June 13, 2018 18:00
Subject:
Re: How do I remove leading zeros?
Message ID:
20180613180018.GA22375@wall.org
I'd probably just write something like:

    s:g { « <( 0+ )> \d+ » } = '';

The first <( and the last » are not strictly necessary, but add clarity, or
at least balance.  But in golf mode you could get away with something like:

    sg/«0+)>\d//;

Larry

Thread Previous | 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