Home > Archive > PERL Programming > December 2005 > hash comparison
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Hello
is there a module, or what is the best way to compare two
hashes and have the differences ?
something like
my %newab = compare(%a,%b)
in %newab i need the values that are in %a but not in %b
and vicevers
my %newba = compare(%b,%a)
thank you
Bye
| |
| Jim Gibson 2005-12-15, 6:57 pm |
| In article <A4mof.86634$65.2505133@twister1.libero.it>, Bill
<bill@coldmail.com> wrote:
> Hello
>
> is there a module, or what is the best way to compare two
> hashes and have the differences ?
>
> something like
>
> my %newab = compare(%a,%b)
>
> in %newab i need the values that are in %a but not in %b
> and vicevers
>
> my %newba = compare(%b,%a)
Check out List::Compare and use it on the keys of your hashes.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
| |
| Matt Garrish 2005-12-15, 6:57 pm |
|
"Bill" <bill@coldmail.com> wrote in message
news:A4mof.86634$65.2505133@twister1.libero.it...
> Hello
>
> is there a module, or what is the best way to compare two
> hashes and have the differences ?
>
> something like
>
> my %newab = compare(%a,%b)
>
> in %newab i need the values that are in %a but not in %b
> and vicevers
>
See the entry that deal with this problem in perlfaq4: How can I get the
unique keys from two hashes?
Matt
|
|
|
|
|