in reply to rounding to nearest
$nearest=10; $price=int(($price+$nearest/2)/$nearest)*$nearest;
This is parametric on the "granularity"
UPDATE: and it also works if $nearest is less than 1 (say you want to round to the nearest 0.5)
-- dakkar - Mobilis in mobile
|
---|
In Section
Seekers of Perl Wisdom