in reply to Integers sometimes turn into Reals after substraction

In addition to LanX's fine answer, see:

  1. numerous nodes in this list
  2. perldoc perlfaq4 at your console (subhead: "Why am I getting long decimals")
  3. What every computer scientist should know about floating point arithmetic
  4. Re: Floating point hell
  5.     ... and many more.

Here in the Monastery, Super Search (used to generate the first link in the list above) will help you answer many of your own questions.