in reply to Unwanted implicit conversion to float
I think that should take care of that. My only concern would be the potential for rounding errors, if any of the numbers that you are matching against have more than two digits after the decimal point. In that case, you might want to just do the sprintf at the end.$val += sprintf( "%.2f", $1 );
If anyone sees a problem with this approach, speak up! I've used it before and would love to know if I boo-booed.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: Unwanted implicit conversion to float
by mirod (Canon) on Mar 12, 2001 at 23:06 UTC | |
by tye (Sage) on Mar 12, 2001 at 23:32 UTC | |
by mirod (Canon) on Mar 12, 2001 at 23:54 UTC |