in reply to deleteing array elements I get mad!!
Apart from all those otherwise good advices there is the most important thing. You should not use delete() on arrays. It doesn't do what you most likely expect. delete() is fine on hashes, but on arrays you should use splice(). Try to run this:
As you can see the 1st item in the array was not removed, but only set to undef, the number of items in the array has not changed. I do think what you want isuse Data::Dumper; my @a = (1,2,3); print Dumper(\@a); delete $a[1]; print Dumper(\@a);
@a = (1,2,3); splice @a, 1, 1; # replace 1 element(s) starting on position 1 by noth +ing print Dumper(\@a);
|
|---|