Maresia has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $data = [ [3328B0Z], [3328B0Z], [887ww45], [887ww45], [9988A676], [8888Q88], [11111X9], [88999S77], [88999S77], [777777f], [A84YY9], [K7788880], [K7788880], [1122222], [8888888T], [8888888T], [87HHY86], [XX11672], [XX11672], [88889999], [88888888], [1122222], ]; my @unique; foreach my $var ( @$data ){ if ( ! grep( /$var/, @unique ) ){ push( @unique, $var ); } } print Dumper \@unique;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Remove duplicated data from array ref
by choroba (Cardinal) on Nov 14, 2016 at 15:05 UTC | |
|
Re: Remove duplicated data from array ref
by johngg (Canon) on Nov 14, 2016 at 15:08 UTC | |
by Anonymous Monk on Nov 14, 2016 at 15:32 UTC | |
|
Re: Remove duplicated data from array ref
by Eily (Monsignor) on Nov 14, 2016 at 15:02 UTC | |
by Anonymous Monk on Nov 14, 2016 at 15:08 UTC | |
by haukex (Archbishop) on Nov 14, 2016 at 15:18 UTC | |
|
Re: Remove duplicated data from array ref
by haukex (Archbishop) on Nov 14, 2016 at 15:04 UTC | |
|
Re: Remove duplicated data from array ref
by hippo (Archbishop) on Nov 14, 2016 at 15:02 UTC | |
|
Re: Remove duplicated data from array ref
by AnomalousMonk (Archbishop) on Nov 15, 2016 at 00:46 UTC |