On 11/8/11 11:36 AM, Shlomi Fish wrote:
Hi Noah,
On Tue, 08 Nov 2011 11:02:39 -0800
Noah<noah-l...@enabled.com> 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?
With the following program:
[CODE]
#!/usr/bin/perl
use strict;
use warnings;
foreach my $n (@ARGV)
{
print int($n/100+0.5)*100, "\n";
}
[/CODE]
I'm getting
shlomif@telaviv1:~$ perl test.pl 530 570 2330 2590 3630 3660
500
600
2300
2600
3600
3700
So it seems to work.
Regards,
Shlomi Fish
Cheers,
Noah
yes - thanks for the math lesson :)
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/