Thanks everyone for your input.

I've decided to go with premchai21's suggestion which "does math", as opposed to Monky Python suggestion which is exactly what I was looking for (I can hear everyone now... 'Is he nuts?!', 'Has he gone mad?', 'First he asks for 'no math' and then he decides to figure out the exact value of pi!', 'Burn him at the stake!').

Ah, but you see my friends, you have all taught me the error of my ways. Math did not make finding a solution more complicated. My problem was that I was not "seeing" the proper math and thus thought it would be a messy solution. In fact, because I cannot trust the intergrity of the data handed to me, math makes my inital problem easier to solve.
My fear is that $bar may be greater than the number of digits in $foo and thus I would need to add zeros in front of the number ($bar=5 $foo=1500 correct result = .01500). This could be done with reg exp, but my new thinking (IMHO) is that math would be a cleaner solution (I hope i'm not opening a can of worms here).

Thanks again everyone for the learning experience.

In reply to Re: Help with decimals by La12
in thread Help with decimals by La12

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.