two hash tables, keys comparision?

two hash tables, keys comparision?

am 28.11.2007 09:30:36 von robertchen117

let's say I have two hash tables: new, old

How to find out the keys in new, but not in old?
How to find out the keys in old, but not in new?

tell me the quickest way.

Thanks.

Re: two hash tables, keys comparision?

am 28.11.2007 09:36:21 von Peter Makholm

"robertchen117@gmail.com" writes:

> How to find out the keys in new, but not in old?
> How to find out the keys in old, but not in new?
>
> tell me the quickest way.

What have you tried?

Re: two hash tables, keys comparision?

am 28.11.2007 12:59:20 von krahnj

"robertchen117@gmail.com" wrote:
>
> let's say I have two hash tables: new, old
>
> How to find out the keys in new, but not in old?

my @keys_in_new_not_old = grep !exists $old{$_}, keys %new;


> How to find out the keys in old, but not in new?

my @keys_in_old_not_new = grep !exists $new{$_}, keys %old;




John
--
use Perl;
program
fulfillment

Re: two hash tables, keys comparision?

am 28.11.2007 16:04:10 von bugbear

robertchen117@gmail.com wrote:
> let's say I have two hash tables: new, old
>
> How to find out the keys in new, but not in old?
> How to find out the keys in old, but not in new?
>
> tell me the quickest way.

Such a politely phrased request...

BugBear

Re: two hash tables, keys comparision?

am 28.11.2007 16:28:52 von smallpond

On Nov 28, 10:04 am, bugbear
wrote:
> robertchen...@gmail.com wrote:
> > let's say I have two hash tables: new, old
>
> > How to find out the keys in new, but not in old?
> > How to find out the keys in old, but not in new?
>
> > tell me the quickest way.
>
> Such a politely phrased request...
>
> BugBear

He did say "Thanks"

Re: two hash tables, keys comparision?

am 28.11.2007 16:40:19 von bugbear

smallpond wrote:
> On Nov 28, 10:04 am, bugbear
> wrote:
>> robertchen...@gmail.com wrote:
>>> let's say I have two hash tables: new, old
>>> How to find out the keys in new, but not in old?
>>> How to find out the keys in old, but not in new?
>>> tell me the quickest way.
>> Such a politely phrased request...
>>
>> BugBear
>
> He did say "Thanks"

A little backwards, but I take your point.

BugBear

Re: two hash tables, keys comparision?

am 28.11.2007 21:18:04 von 1usa

smallpond wrote in news:85356d58-b29b-45cc-871c-
c3327efbe1db@i12g2000prf.googlegroups.com:

> On Nov 28, 10:04 am, bugbear
> wrote:
>> robertchen...@gmail.com wrote:
>> > let's say I have two hash tables: new, old
>>
>> > How to find out the keys in new, but not in old?
>> > How to find out the keys in old, but not in new?
>>
>> > tell me the quickest way.
>>
>> Such a politely phrased request...
>>
>> BugBear
>
> He did say "Thanks"

where he should have said *please*.

Sinan

--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: