in reply to use of print f and sprint f

...printf or sprintf in order to get only 3 decimal places...

According to perldoc -f sprintf, do it this way:

printf "$l,$j,%.3f,%.3f,%.3f,%.3f\n", $Hx, $Hy, $Hxy, $mutual;

Cheers, Sören