in reply to changing array size in foreach loop: is it safe?
my $i = 0; while ($i <= $#foo) { push @foo, 'h' if $foo[$i] eq 'd'; print $foo[$i]; $i++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: changing array size in foreach loop: is it safe?
by Errto (Vicar) on Feb 08, 2005 at 05:59 UTC |