Hello pango and welcome to the monastery and to the wonderful world of Perl!

You already got the correct answer, so apart my welcome, I only want to comment:

> I am only interested because I find this an easy way to remove trailing decimal zeroes, and if I can get away with not using sprintf then that would be great.

you dont pay CPU cycles nor characters in your program, do you? So it is better to embrace the more idiomatic style you can, without relying on edge cases to accomplish simple tasks as the precision of a number. One of our wise brothers has in their signature: Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond and even if in Perl there are many way to get the job done I suggest you to write your programs in the clearest form you can get.

Another great motto goes like: Being debugging twice harder than programming, dont program at your best as you dont be able to debug it, by definition

Imagine a weird bug in your 5k lines of perl code spread among different modules, a bug due to a weak assumption on perl rounding beahviour... good luck :)

Explore edge cases, try everything, but when you write something intended to be usable and durable choose the plainest way.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Perl 5 numeric type and simplifications by Discipulus
in thread Perl 5 numeric type and simplifications by pango

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.