On Wed, Aug 6, 2008 at 11:01 AM, <[EMAIL PROTECTED]> wrote: > Hi, > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc..... > > Right now I can only do the above by extracting the first digit using > splice , then add one. > > Thanks > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > Just use split function like this
my $val= 0.123; my($a,$b)=split(/\./,$val); my $final=($a+1); print "$val=$final"."\n"; Thanks & Regards Anirban Adhikary