for ( 0 .. $#array ) { my $element = shift @array; push @array, $elt eq 'condition' ? my_sub( $elt ) : $elt; }
Update: As suggested by Skeeve in his reply below, I've written an explanation in my reply to him.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Inserting into an array while stepping through it
by sauoq
in thread Inserting into an array while stepping through it
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |