After discovering (being shown) the whole float/int issue, I did indeed end up casting the the number as cyan01 showed.
$temp = int($myNum / 10);
Thanks again folks.
I used rharsh's code initially, and it worked beautifully. However, I ended up using mikevh's idea for the simplicity, not that any were complicated.
I feel slightly ashamed with the fact I didn't realize I was using a float rather than an int. It didn't even cross my mind to change it! Not too...
Honestly, it's been a few years since I've used Perl, and it was never something I used on a regular basis. This is probably a simple question, although I am having issues finding an answer. I have the following calculation:
$temp = $myNum / 10;
$newNum = sprintf("%.0f\n",$temp);
The issue is...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.