http://www.perlmonks.org?node_id=208438


in reply to how to rm an element from an array?

I don't do this personally, but the delete function can be used, instead of grep, if you want to preserve the array indices:
perldoc -f delete
Given an expression that specifies a hash element, array element, hash slice, or array slice, deletes the specified element(s) from the hash or array. In the case of an array, if the array elements happen to be at the end, the size of the array will shrink to the highest element that tests true for exists() (or 0 if no such element exists).
for (0..$#arr) {delete($arr[$_]) if $arr[$_] eq $var;};
I'd use grep, otherwise (IO has provided an example of how to use grep).

Gyan Kapur
gyan.kapur@rhhllp.com