in reply to Re: Re: Unique keys for multiple values with a Hash
in thread Unique keys for multiple values with a Hash
Update: I see that Ovid also has a good one-pass solution.while ((my $key, my $value) = each %hash) { print "the Key is: $key\n"; my %seen = (); # Perl Cookbook 4.6 Extracting Unique Elements from a List my @uniq = grep { ! $seen{$_}++ } @$value; print join("\n",@uniq),"\n\n"; }
|
|---|