[EMAIL PROTECTED] wrote:
>
> Hi All, i found this as a Bug in Perl
>
> consider....
> for($i=0;$i<0.4;$i=$i+0.1)
> {
> print "$i\n";
> }
>
>
> here you wiil get output as expected...
> 0 to 0.3
> it work fine till test is $i<0.7...UPTO HERE EVERYTHING IS GOING
> RIGHT
> BUT magic starts here
>
>
> for($i=0;$i<0.8;$i=$i+0.1)
> {
> print "$i\n";
> }
>
>
> when i take test as $i<0.8
> output is strange...
> it is
> 0 to 0.8 isted of 0 to 0.7
> same for $i<0.9...
> thus 0.8 onwords ...less than not working as expectation.....
>
>
> it is working as <=
>
>
> isn't it a Joke
The correct way to write this is
for (0 .. 8) {
my $i = $_/8;
print "$i\n";
}
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/