On Wed, May 30, 2001 at 09:07:24AM -0500, Jarkko Hietaniemi wrote:
> +(19.95) and divide by 100 at the end. In fact, if you are dividing by
> +100, you don't even need to really divide-- just split of the
> +fractional parts and insert the '.' (or whichever is your decimal
> +separator) in between, e.g.
> +
> + sub d100 {
> + $_[0] =~ /(.*?)(.(?:.)?)$/;
> + sprintf("%d.%02d", $1||0, $2);
> + }
> +
> +and then display all your numbers like this: C<d100($number)>
In general, using $1 et al. without checking that the match succeeded is a
bad practice; I'm not sure it should be used in the FAQ.
Ronald