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:

use Data::Dumper; my @a = (1,2,3); print Dumper(\@a); delete $a[1]; print Dumper(\@a);
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 is
@a = (1,2,3); splice @a, 1, 1; # replace 1 element(s) starting on position 1 by noth +ing print Dumper(\@a);