in reply to Strange result on array
> If any part of LIST is an array, foreach will get very confused if you add or remove elements within the loop body, for example with splice. So don't do that.
You don't use splice, but instead you change the arrays the loop iterates over:
@img = grep {!/$rr/} @img; @vid = grep {!/$rr/} @vid;
So don't do that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange result on array
by solocazzimiei (Novice) on Apr 02, 2021 at 18:21 UTC |