in reply to Why do I get random numbers?

1 with 30 1s after the decimal point

Note that, owing to the limited precision of the double, the last 13 1s have no effect on the value assigned to $num. Those 13 1s might just as well be 9s or 0s:
C:\>perl -le "printf '%.20e', 1.11111111111111119999999999999;" 1.11111111111111116045e+000
Cheers,
Rob