Dear Master, based on your previous code, I need to count individual type of files beside the whole files from system via the txt file. I tried in this way as below but it doesn't show the correct number of individual type of files, please point out the cause of mistake or provide me the correction, thanks!

my $goodfile = ' good.txt ' my $badfile = 'bad.txt' %jan = ('max' => 0, 'bytes' => 0, 'files' => 0, 'gfiles =>0, 'bfiles = +> 0); %feb = ('max' => 0, 'bytes' => 0, 'files' => 0, 'gfiles => 0, 'bfiles +=> 0); for (6..31) {$m[$_] = \%jan} for (32..59) {$m[$_] = \%feb} while(<DATA>){ if($goodfile='gfiles') {($day, $value, $name) = split / /; print "$day $value\n"; ${$m[$day]}{'max'} < $value ? ${$m[$day]}{'max'} = $value, ${$m[$day]}{'bytes'} += $value, ++${$m[$day]}{'gfiles'}):( ${$m[$day]}{'bytes'} += $value, ++${$m[$day]}{'gfiles'}) ; } print "jan\n"; foreach (sort keys %jan){ print "$_ $jan{$_}\n"; } print "feb\n"; foreach (sort keys %feb){ print "$_ $feb{$_}\n"; } __DATA__ 006 175 FILENAME 006 176 good.txt 006 12 bad.txt 007 1856 FILENAME 007 1854 good.txt 008 172 bad.txt 008 177 FILENAME 008 23 good.txt 010 42 bad.txt 032 175 FILENAME 033 2345 FILENAME 032 318 good.txt 033 100 bad.txt 034 175 FILENAME
download

In reply to Re^2: Help! Stuck on methods to count file size. by haimei
in thread Help! Stuck on methods to count file size. by Anonymous Monk

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.