in reply to I have Wma file jammed in my regex
A better way to do it would be to put the loop for your servers on the OUTSIDE, and then loop (or regex, or whatever) through each data type. This means your computer doesn't have to open (and read!) each server log more than once. Kinda like this pseudo-code:
You'll probably be able to speed this up even more if you just put in an all encompassing regex instead of a loop for the media types. But however you do it you'll be better off putting the big things on the outside, and the little things on the inside.for $server(@servers) { my (@open, %found_total); # Initialize for each run open IN, $server; while (<IN>) { # Keeps from loading the whole file in for $type($mediatypes) { if (/\.$type) { my $kbytes = (stat)[7]/1000; $found_total{$1} += $kbytes; push @output, ("$_ : $kbytes"); } } } # Output your @output array here if you want, # and/or %found_total (which contains the kbyte totals) }
Gary Blackburn
Trained Killer
|
|---|