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
In reply to Re: any built in function to take out null arrays elements?
by CountZero
in thread any built in function to take out null arrays elements?
by adrive
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |