in reply to Removing duplicate values for a hash of arrays
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my %hash = ( a => [ '1','2', ], b => [ '2','3', ], c => [ '1','2', ], ); my $testing_now = 'a'; for (keys %hash) { next if ($testing_now eq $_); if ($hash{$testing_now} ~~ $hash{$_}) { print "$testing_now is duplicate of $_\n"; } #This is an update! Forgot this next line in initial post $testing_now = $_ } # Returns a is duplicate of c c is duplicate of a (.02 version)
I did not see the part about duplicate values earlier. I'm not sure how to do it without the smart match easily! I think for me it would be easier to compile a new version of Perl! reverse!
|
|---|