Another way to do that safely is to process the array backward:
@x = 1..10;; for my $i ( reverse 0 .. $#x ){ $x[ $i ] & 1 and splice @x, $i, 1; };; print @x;; 2 4 6 8 10
In reply to Re^2: removing a hash from an array of hashes
by BrowserUk
in thread removing a hash from an array of hashes
by Conal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |