On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote:
This all works fine, but in the last step of the program I am trying to get the program to tell me key's that are unique to only the first hash. No matter what I do it always prints out all of the values in the first hash, not the keys that are unique to only the first hash.
foreach $key_h (keys %hash) { foreach $key_dbm (keys %dbmhash) { unless ($key_h eq $key_dbm) { print "$key_h\n"; } } }
Romeo, You are not doing what you said. The loop above prints the keys of the first hash which differs from every key of the second hash. That explains why it seemingly prints out all of the values. foreach $key_h (keys %hash) { print "$key_h\n" unless exists $dbmhash{$key_h}; } will work better. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>