in reply to whats wrong with this code?
You're iterating over an array that you are modifying at the same time. This is not a recommended approach and doesn't do what you want anyway:
foreach(@array){ shift (@array);
Most likely you want to keep on going while the array @array is not empty. Using a while loop is better for that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: whats wrong with this code?
by purnak (Acolyte) on Jan 18, 2017 at 09:03 UTC | |
by LanX (Saint) on Jan 18, 2017 at 12:59 UTC |