On 08/11/2011 19:02, Noah wrote:
Hi there,
I am trying to round to 10 or 100 for particular values
so the following numbers
530
570
2330
2590
3630
3660
would become
500
600
2300
2600
3600
3700
any clues how to do this well?
The classical method uses sprintf, as in the code snippet below.
HTHm
Rob
foreach (qw/530 570 2330 2590 3630 3660/) {
my $round = sprintf "%.0f00", $_/100;
print "$round\n";
}
**OUTPUT**
500
600
2300
2600
3600
3700
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/