Re: newbie stuck in a hash

2003-02-01 Thread R. Joseph Newton
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

Re: newbie stuck in a hash

2003-01-31 Thread John W. Krahn
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

RE: newbie stuck in a hash

2003-01-31 Thread Pam Derks
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_

RE: newbie stuck in a hash

2003-01-31 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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

RE: newbie stuck in a hash

2003-01-31 Thread Hanson, Rob
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