in reply to infinite loop on while (@array)
Anyway, the loop you want to use is an infinite loop, unless you empty the array. It will test TRUE as long as the array has more than 0 elements.my $count = 10; while ($count) { #do something to array print $array[$count--]; } # alternative $count =0; for (@array) { print "$count $_\n"; # $_ is the current array item $count = &something_complex; }
my $count =0; while(1) { # do something to the array $count = &something_strange last if (test_exit_condition); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: infinite loop on while (@array)
by Juerd (Abbot) on Mar 27, 2002 at 07:44 UTC | |
by demerphq (Chancellor) on Mar 27, 2002 at 10:43 UTC | |
by Kanji (Parson) on Mar 27, 2002 at 14:33 UTC | |
by demerphq (Chancellor) on Mar 27, 2002 at 15:21 UTC | |
by Juerd (Abbot) on Mar 27, 2002 at 15:16 UTC | |
by demerphq (Chancellor) on Mar 27, 2002 at 15:40 UTC |