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!
downloadmy $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
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |