my $num = 5.26256; my $formatted = sprintf( "%.2f", $num ); print "$formatted\n";