my $x; for ($x=1; $x <= 2; $x += 0.1) { print "$x\n"; } print "Stop: x=$x\n"; print "No, x is not 2.\n" if $x != 2; Output: 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 Stop: x=2 No, x is not 2.