#!/usr/bin/perl use strict; my @a; $a[0] = (0.1 - 0.1) * 10; #Should be 0 $a[1] = (0.2 - 0.1) * 10; #Should be 1 $a[2] = (0.3 - 0.1) * 10; #Should be 2 $a[3] = (0.4 - 0.1) * 10; #Should be 3 $a[4] = (0.5 - 0.1) * 10; #Should be 4 my $i; for( $i = 0; $i < 5; $i++ ) { print "$i: ", $a[$i], " ", int($a[$i]), "\n"; } print "\n"; for( $i = 0; $i < 5; $i++ ) { printf "%d: %s %d %f\n", $i, $a[$i], $a[$i], $a[$i]; }