Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Eliminating Trailing Zeros

by Aristotle (Chancellor)
on Jul 17, 2003 at 15:15 UTC ( [id://275242]=note: print w/replies, xml ) Need Help??


in reply to Eliminating Trailing Zeros

For completeness' sake, one that doesn't break when there's no decimal point.
s/(?:(\.\d*[1-9])|\.)0+\z/$1/;

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://275242]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-18 18:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found