Using sprintf to format a float-point number and assign the result to a variable
$variable1 = sprintf "%.4f", 3.1415926; print $variable1;