in reply to any built in function to take out null arrays elements?

@userArray2 contains nothing, not even NULL, so there is nothing to delete.

But perhaps you are thinking of an array containing empty elements: @array_with_empties = ('ONE', 'TWO', '', 'FOUR');

$array_with_empties[2]) is empty, but exists($array_with_empties[2]); will return a TRUE value! Indeed the array element exists, but is empty.

To check if this array-element is empty, simply test it against the empty element '' or against undef.

And to answer your question: you will always need a loop (explicit or implicit) to check for such elements.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: any built in function to take out null arrays elements?
by chromatic (Archbishop) on Sep 21, 2007 at 08:39 UTC
    To check if this array-element is empty, simply test it against the empty element '' or against undef.

    Empty, a blank string, and undef are different things though!

    Update: string, not strong.

      They are indeed and zero will also have to be considered in such test, but failing more info of the practical side of what the OP wants, one cannot give more detailed help.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James