#!/usr/bin/perl -w use strict; my $num = 5.8687; my ( $int, $float ) = split '.', $num; #$float = 5 if $float > ?; #$float = 0 if $float < ?; # example should print '5.5' print $int . '.' . $float . "\n";