Pam Derks wrote:
> my %all_keys = ();
>
> foreach my $key (keys %hash1) {
> $all_keys{$key} = 1;
> }
>
> foreach my $key (keys %hash2) {
> $all_keys{$key} = 1;
> }
Hi pam,
It strikes me that you are throwing away information here. Even if that information
is not needed in the immediate context, it is not a good habit to develop. At the
taime that you are loading %all_keys, you know which hash is the source. It seems to
me that %all_keys should retain this information.
foreach my $key (keys %hash1) {
$all_keys{$key} = 1;
}
foreach my $key (keys %hash2) {
$all_keys{$key} = 2;
}
If all you need to know is that there is a value for the key, this will still respond
properly to:
if ($all_keys{$key}) {...}
but still leaves you the option of tracing back to the source of the information.
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]