Ok, I had a few minutes to jump into this and have some more questions.
I used the following code (pardon the ugly vim line numbers):
183 my %seen = (); 184 185 open (FH, "< $resultsFile"); 186 my @lines = <FH>; 187 foreach my $line (@lines) { 188 my @values = split ',', $line; 189 190 my $col1_val = $values[0]; 191 my $key = $values[2]; 192 my $errors = $values[7]; 193 194 $key =~ s/LOGGED IN //; 195 $key =~ s/ GET //; 196 $key =~ s/ POST //; 197 198 # print "$key\n"; 199 200 $key = $1; 201 202 $seen{$key}->{error_count}++ if $errors eq 'false'; 203 push @{$seen{$key}->{col1_vals}}, $col1_val; 204 205 } 206 207 foreach my $key (keys %seen) { 208 my $error_count = $seen{$key}->{error_count}; 209# my $calcd = 210 print <<HERE; 211 Key: $key 212 Errors: $error_count 213 HERE 214 } 215 216 close (FH); 217 218 die;
This does not print out any results for key or errors (lines 211 and 212). Perhaps something is being read wrong? The commented out line on 198 does return the values as intended however.
My second question is regarding the calculations. How do I grab all of the col1_vals together in order to run an average since it is going through line by line?
Thanks as always!
-bp-
In reply to Re^3: Hashes, Arrays, and Confusion -- In a bit over my head!
by bpthatsme
in thread Hashes, Arrays, and Confusion -- In a bit over my head!
by bpthatsme
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |