my $diff = 0.005; if ( abs($num1-$num2) < $diff ) { print "they're close enough\n"; }