#!/usr/bin/perl -w use strict; my $n=34.57889; my $na=sprintf("%3.3f",$n); print "$n $na\n"; OUTPUT: 34.57889 34.579