The standard Perl approach to rounding numbers (with sprintf) amounts to using a string manipulation for what is arguably an arithmetic task. Did you have any particular error in mind?
When I first saw the question, the two solutions I thought of were $x - int( $x ) or indeed something along the lines of $x =~ s/\d+(?=\.)//, and I'm curious about what errors could have resulted from the latter approach.
the lowliest monk
In reply to Re^3: Coping with decimals
by tlm
in thread Coping with decimals
by Ruanae
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |