Comparing arrays

2000-01-05 Thread Dheeraj Jangalwa
Hi Perl Gurus, I got two passwd files, Iam able to create two different hashes using "userid"as the key. Now I wanna compare those two hashes and print out the fields that dont match. I would appreciate if someone can help in doing so. Thanx --

Re: Comparing arrays

2000-01-05 Thread Ed Phillips
Really Dheeraj, This is not a mod_perl specific question, and I don't know the all important context into which this boilerplate code you are seeking to elicit from the list is to be dropped. here is a boilerplate "find me keys that are not in both hashes": foreach (keys %hash_one) {

Re: Comparing arrays

2000-01-05 Thread Cliff Rayman
I didn't read the original post but based on your spec of: "find me keys that are not in both hashes" I think the boilerplate code should be: foreach (keys %hash_one) { push(@here_not_there, $_) unless exists $hash_two{$_}; } foreach (keys %hash_two){ push(@here_not_there,

Re: Comparing arrays

2000-01-05 Thread Ed Phillips
Cliff, I wanted him to work for the rest of it, or at least go to another list. It looks like he wanted two arrays, @in_hash_one_alone and @in_hash_two_alone, so having him push to one array may confuse him. he's better off doing a little studying, methinks. ed