Wang, Li wrote:
Dear All

Hello,

I have an array of a series of strinngs. I want to set up a
condition in which all the scalers in the array are not the same.

For example

AB AB AB AB AB (delete the array)
AB AC AB AB AB (Keep the array)
AB AC AD AB AB (keep)

$ perl -le'
for ( [ "AB", "AB", "AB", "AB", "AB" ], [ "AB", "AC", "AB", "AB", "AB" ], [ "AB", "AC", "AD", "AB", "AB" ] ) {
    my @array = @$_;
    if ( @array == grep $array[ 0 ] eq $_, @array ) {
        print "delete @array";
        }
    else {
        print "keep @array";
        }
    }
'
delete AB AB AB AB AB
keep AB AC AB AB AB
keep AB AC AD AB AB




John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to