kencl
User
Feb 4, 2001, 9:10 PM
Post #1 of 3
(247 views)

Converting Real Number to Integers

Can't Post


I tried:
$width = # a real number with lots of decimal places $percent = # a real number with lots of decimal places use integer # switch to integer mode $width /= 1; $percent /= 1; # converts reals to integers < obviously not! $percent .= '%'; # single quotes arn't subject to interpolation, no need to escape the percent sign no integer # back to real number mode print "width is $width, and percent is $percent."; result: width is 35.7142857142857, and percent is 6%. How do I force $width to be an integer? Why doesn't PERL just have a DIV operator to complement the MOD operator anyway? >> If you can't control it, improve it, correlate it or disseminate it with PERL, it doesn't exist!
