Brian, It's round-off error.
Try the following: printf "%0.1f Ghz\n", $speed; Cheers, Sui -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Gibson Sent: Sunday, May 23, 2004 3:49 PM To: [EMAIL PROTECTED] Subject: weird stuff in incrementing "for" loop with Perl Can anyone explain why in this simple "for" loop it changes after it gets to 6.1? I am trying to create a pull down menu for a web page that lists processor speeds from 1.0 Ghz all the way up to 20.0 Ghz and things get crazy in between. I am incrementing my counter by .1 each time thru the loop. $starting_number = 1.0; $ending_number = 20.1; for ($speed = $starting_number; $speed < $ending_number; $speed = $speed + .1) { print "$speed Ghz\n"; } ## End of "for 1.0 Ghz to the total possible speed of the processors....." _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs