#!/usr/local/bin/perl -w use strict; my $n = 34.57889; my $d = 4; # Num of right hand digits to grab my ($lhs,$rhs) = split /\./,sprintf("%f",$n),2; $n = join '.',$lhs,substr($rhs,0,$d); print "$n\n";