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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.