in reply to Updating one hash from another and pruning

I'm not going to try to figure out what prunecheck is doing, it's certainly doing more than you describe (it's recursive, on doing different things based on the argument types).

But looking at the problem you describe, don't you want something like:

%hash3 = %hash1; @hash3 {grep {exists $hash2 {$_}} keys %hash1} = @hash2 {grep {exists $hash2 {$_}} keys %hash2};
If not, then I don't understand what you want.

Abigail

Replies are listed 'Best First'.
Re: Re: Updating one hash from another and pruning
by Anonymous Monk on Aug 15, 2002 at 02:21 UTC
    > ....it's certainly doing more than you describe Well, yes, it has stubs to print out the details of the final hash -- down to the base (scalar) level. Incidentally, I +think+ it has a problem at the ARRAY level -- don't think it necessarily handles arrays of hashrefs (cf arrays of scalars)... Re: the grep combination -- doesn't it assume you only have one level of hash keys ? -- and so doesn't allow generalizations to the multidimensional hash of hashes level? An advantage of the recursive traversal is that it's designed to descend through all levels...