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 con
Pam Derks wrote:
>
> Hi all,
Hello,
> I have 2 files that contain a filename and # of hits
> I've split the contents of these 2 files into %hash1 and %hash2
> I want to find out the difference in the # of hits
> can someone shed some light on the approach I should take.
>
> I've gotten this far
Thanks much!, I think I've got it now
:) Pam
>>> "Hanson, Rob" <[EMAIL PROTECTED]> 01/31/03 12:32PM >>>
This should do it...
my %all_keys = ();
foreach my $key (keys %hash1) {
$all_keys{$key} = 1;
}
foreach my $key (keys %hash2) {
$all_keys{$key} = 1;
}
foreach my $page ( sort( keys(%all_
Pam Derks wrote:
> Hi all,
>
> I have 2 files that contain a filename and # of hits
> I've split the contents of these 2 files into %hash1 and %hash2
>
> I want to find out the difference in the # of hits
>
> can someone shed some light on the approach I should take.
>
> thanks in advance,
> Pa
This should do it...
my %all_keys = ();
foreach my $key (keys %hash1) {
$all_keys{$key} = 1;
}
foreach my $key (keys %hash2) {
$all_keys{$key} = 1;
}
foreach my $page ( sort( keys(%all_keys) ) ) {
my $diff = $hash1{$page} - $hash2{$page};
my $diff = abs($diff); # remove "-" sign
print