in reply to Remove empty element.

As I know that I get the empty element at first
You can unconditionally remove the first element of a list using shift.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: Remove empty element.
by pemungkah (Priest) on Jul 14, 2009 at 18:43 UTC
    Or grep away null elements. I admit that I do this sometimes simply to save cognitive load as opposed to CPU load.
    my @array = ('',1,2,'',3,'',4); @array = grep { $_ } @array; print join "}{",@array; print "\n";
    gives
    1}{2}{3}{4
      @array = grep { $_ } @array;

      This grep also removes array elements that happen to be 0. Use grep { defined && length } instead if you want to have the 0 elements in the result.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        Good catch - in this case there aren't any, but you're still right. :)