in reply to limit of for loop!!
You could use 'sprintf' as part of the loop. Adds some time, but maintains your 3 digits of precision.
perl -e '$n=22.4; for(1..99) { $n = sprintf("%.3f", $n+0.001 ); } prin +t "Result: $n\n";'
Hint: Try to think of your numbers as '$n' or '$s' and not '$a'. You'll understand in the future.
Good Luck
"Well done is better than well said." - Benjamin Franklin
|
|---|