[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Does a hash contain any keys other than <LIST>?



Chaim wrote:
> PS> want to know just whether it contains any keys *other* than those listed 
> PS> in, say, @k. 
> 
> How about:
> 
> 	join(':',sort keys %h) eq join(':', sort @k)
> or
> 	@t{@k, keys%h}=();
> 	scalar(keys %t) != scalar(@k);

But that fails for the case where %h doesn't have some of the keys
listed in @k.  Probably important; at least, Peter's solution
doesn't fail that way.

John Porter


==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org