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

If it's small enough to load all at once:

$array = join /$splitter/, @array; # where $splitter is a scalar that +will not be in an element $array =~ s/$splitter{2,}/$splitter/g; @array = join $splitter, $array;

Variations would be required for multi-line strings, of course.

Update: inserted a missing $.