sub round($$) { sprintf "%.$_[1]f",$_[0]; } print round(8.7385, 2); # prints 8.74