What do you need to do? Assignment to undef in this way will "swallow" an item from the list returned by the function call; you will see it no more. Which item do you need to get rid of?
But Your Mother is right: Fix this code, don't patch it; it's an accident waiting to happen.