in reply to how to delete without resulting in undef

Command splice is one. It removes the elements completely.

$array[$n]="" clears it.