in reply to Remove Array Duplicates from Array of Arrays
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $a = [ "hello", "day", "sun and fun" ]; my $b = [ 2, "okay", "may" ]; my $c = [ "hello", "day", "sun and fun" ]; my %dup; my @MyArrayOfArray = grep !$dup{Dumper $_}++, $a, $b, $c; print Dumper \@MyArrayOfArray;
Outputs:
$VAR1 = [ [ 'hello', 'day', 'sun and fun' ], [ 2, 'okay', 'may' ] ];
Avoids trying to find a unique separator.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Remove Array Duplicates from Array of Arrays
by Anonymous Monk on Sep 01, 2018 at 13:10 UTC |