When I used lt instead of < operator, it works as you expected. Still, lt operator used for comparing strings not for numerals. As per my understanding, perl tries to implicitly convert both $i and 1 as strings and do comparison. If somebody finds different reason for it, kindly clarify me.
my $range = 0.1; my $i = 0; while( $i lt 1 ) { print $i."\n"; $i = $i + $range; }
In reply to Re: Simple adding numbers
by nvivek
in thread Simple adding numbers
by WojciechGajewski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |