in reply to Re^4: SIMPLE way to write these?
in thread SIMPLE way to write these?
You are comparing $number2 and $number1 in your while; neither ever changes. That's why you get an infinite loop. Here is a solution that preserves the value in $number1.
my $number1 = 1; my $number2 = 10; my $i = $number1; while ($number2 >= $i) { print $i++,"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: SIMPLE way to write these?
by Jenda (Abbot) on Feb 05, 2014 at 09:59 UTC |