in reply to Array Cleaning
Maybe I'm missing something, but why are you not using grep? E.g.
@array = (3, 2, 1, "", 2, undef); @cleanarray = grep { defined $_ && $_ ne "" } @array; @sortedcleanarray = sort grep { defined $_ && $_ ne "" } @array;
Of course, this will not remove duplicates. From your post I am not sure whether you want that or not (Your "should be" output has the duplicates removed).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Array Cleaning
by Anonymous Monk on May 02, 2003 at 17:01 UTC | |
by Aristotle (Chancellor) on May 03, 2003 at 03:01 UTC | |
by crenz (Priest) on May 02, 2003 at 17:11 UTC |