sub eqfloat4 { return sprintf("%.4f", shift) eq sprintf("%.4f", shift); } if (eqfloat4 1.23455, 1.23456) { print "Numbers are equal to four decimal places."; }