in reply to how to delete without resulting in undef
You probably want to use splice which removes elements entirely from the array, rather than delete which only deletes their values:
perl> @a = (1 .. 10);; perl> delete $a[ 3 ];; perl> print "@a";; Use of uninitialized value in join or string at 1 2 3 5 6 7 8 9 10 perl> @a = (1 .. 10);; perl> splice @a, 3, 1;; perl> print "@a";; 1 2 3 5 6 7 8 9 10
|
|---|