There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
$n =~ s/\.?0+$//;
Update: Thanks to dreadpiratepeter for spotting my stupid mistake. The better option would be $n =~ s/\.\d*?0+$//; Update2: That worked with my test data but only because I wasn't using formatted strings so trailing 0s were already dealt with. Doh! With a %x.yf formatted string the original approach will work fine. jmcnamara came up with probably the best solution Re: Eliminating Trailing Zeros In reply to Re: Eliminating Trailing Zeros
by Lachesis
|
|