#!/usr/bin/perl -p # round [N.M] - round all decimal numbers on input to N.M digits BEGIN { $prec = shift || ".3" } s/\d+\.\d+/sprintf("%${prec}f",$&)/ge