in reply to While loop;s different behavior

Hello Maahi,

Welcome to the Monastery. Although the fellow Monk huck has provided you with a solution to your problem. I think you can still learn a few more things by reading this similar question perl floating number addition, with solutions provided to your problem.

Just for your information in Perl if your search the web 90% if not 99% you will find someone has created a module that can do exactly what you want to accomplish. For example Math::Decimal, this is the beauty of Perl.

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!