in reply to Hash table question
Assume %hash1 and %hash2 are already defined with the data you need:
elements common between two tables
my @common = grep { $_ if exists $hash2{$_} } keys %hash1;
elements unique to table #1
my @unique1 = grep { $_ unless exists $hash2{$_} } keys %hash1;
elements unique to table #2
my @unique2 = grep { $_ unless exists $hash1{$_} } keys %hash2;
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: Hash table question
by merlyn (Sage) on Jun 24, 2003 at 16:58 UTC | |
|
Re: Re: Hash table question
by halley (Prior) on Jun 24, 2003 at 16:58 UTC | |
by merlyn (Sage) on Jun 24, 2003 at 17:01 UTC |