But if you play around with hashes you'll probably end up with some more clever solution :)use Data::Dumper; %input=(r=>[1..10],s=>[1..10],t=>[5..10],u=>[11..20]); grep{$hash{"$input{$_}[0]_$input{$_}[-1]"}++;$tmp{$_}=$input{$_} if $h +ash{"$input{$_}[0]_$input{$_}[-1]"}==1}keys %input; print Dumper(\%tmp);
cheers
baxy
Update: Ups , I just sow some extra conditions Corion pointed out so i don't think this will work for you but this should :)
(haven't tested it yet->possible bugs for you to remove:))use Data::Dumper; %input=(r=>[1..10],s=>[1..10],t=>[5..10],u=>[11..20]); grep{$hash{$input{$_}[0]}->{$input{$_}[-1]}++;$hash_1{$input{$_}[0]}++ +;$hash_2{$input{$_}[-1]}++;$tmp{$_}=$input{$_} if ($hash{$input{$_}[0 +]}->{$input{$_}[-1]}==1 && $hash_1{$input{$_}[0]}==1 && $hash_2{$inpu +t{$_}[-1]}==1 )}keys %input; print Dumper(\%tmp); Output: $VAR1 = { 'u' => [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], 'r' => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] };
cheers
In reply to Re: Remove the duplication in Hash values
by baxy77bax
in thread Remove the duplication in Hash values
by Kandankarunai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |