in reply to Array Cleaning

Here is the simple solution in terms of what you want to achieve.
my %X; @clean_ord_array = grep {!defined $X{$_} and $X{$_} = 1 } grep /\d+/ ,@array; print join "\n", @clean_ord_array,"\n"; print join "\n", sort { $a <=> $b } @clean_ord_array,"\n"
artist

Replies are listed 'Best First'.
Re: Re: Array Cleaning
by Anonymous Monk on May 02, 2003 at 18:20 UTC

    Thanks, this works great.

    How I additionally remove all whitespaces from every element (s/\s//g)?

      It doesn't look like that you have white spaces in the numbers. To resolve your problem, just in case.. you can put our code before the @array using map.
      my %X; @clean_ord_array = grep {!defined $X{$_} and $X{$_} = 1 } grep /\d+/, map { s/\s//g } @array;
      artist