in reply to Removal of "NULL" element in an array?

If the null element is the last in the array then you can  pop @array
Or as your example states, at the beginning of the array, shift @array
However for anything trickier , like removing the null at $array[45] , you want to investigate splice


Regarding chomp, chomp will only remove a newline char from a string (or array of strings).
I can't believe it's not psellchecked

Replies are listed 'Best First'.
Re: Re: Removal of "NULL" element in an array?
by bart (Canon) on Jan 07, 2003 at 23:56 UTC
    However for anything trickier , like removing the null at $array[45] , you want to investigate splice
    or grep.
    @a = grep { $_ ne '' } @data;