in reply to Remove duplicated data from array ref

I'm not sure what your data is actually supposed to be (your declaration for $data is not valid perl, is this supposed to be an array of strings?) but there's a simple way to get unique elements in perl: hash keys.

my %uniq; my @data = qw(3328B0Z 3328B0Z 1122222 8888888T 3328B0Z 1122222 8888888 +T); $uniq{$_}++ for @data; my @uniq_data = keys %uniq
You should avoid removing elements from an array while iterating over it, so outputing to another variable is probably better.
Or, you can use the sub uniq from List::Util

Replies are listed 'Best First'.
Re^2: Remove duplicated data from array ref
by Anonymous Monk on Nov 14, 2016 at 15:08 UTC
    Hi, the data is just like that:
    my $data = [ ['3328B0Z'], ['3328B0Z'], ['887ww45'], ['887ww45'], ['9988A676'], ['8888Q88'], ['11111X9'], ['88999S77'], ['88999S77'], ['777777f'], ['A84YY9'], ['K7788880'], ['K7788880'], ['1122222'], ['8888888T'], ['8888888T'], ['87HHY86'], ['XX11672'], ['XX11672'], ['88889999'], ['88888888'], ['1122222'], ];