I don't know if this will solve your problem, but it seems like you're opening each server log 1x for each data type, which is a pretty big waste of time seeing as how your media type list is short, and your server logs are (almost certainly) alot bigger. This is extremely inefficient.

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:

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) }
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.

Gary Blackburn
Trained Killer


In reply to Re: I have Wma file jammed in my regex by Trimbach
in thread I have Wma file jammed in my regex by OzzyOsbourne

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.