in reply to I have Wma file jammed in my regex

Thanks for the pointers. I was embarrassed by all the responses, and I probably shouldn't have posted it. All of the responses were helpful in making changes to the code, but they did not solve the problem.

I tried to find out what pseudo code was, but I think that that may have been some sort of insult.

I'll get around to updating this properly when I figure out what's going on.

Thanks again!

#sifts all the server logs based on media type use strict; my ($type, $server,$out,$in,@input,$total,$kbytes,$mbytes); my @servers=('a','b','c','d','e','f','g','h','i','j','k','l','m','n',' +o','p','q','r','s','t','u','v','w','x','y','z','aa','bb','cc','dd','e +e','ff','gg','hh','ii','jj','kk','ll','mm','nn','oo','pp'); my $dir1='//worksatation/share/dir/'; my @types=('mp3','avi','mpg','mpe','wav','mov','rmj','zip','exe','wma' +); foreach $type (@types){ $total=0; open OUT, ">$dir1/sifted/$type\.txt" or die "Cannot open $out for +write :$!"; foreach $server (@servers){ $in="$dir1/$server\.txt"; open IN,"$in" or next; @input=<IN>; chomp @input; foreach (@input){ if (/\.$type$/i){ $kbytes = (stat)[7]/1024; $total+=$kbytes; print OUT "$_\t$kbytes KB\n"; } } close IN; } $mbytes=$total/1024; print OUT "\n\nTotal: $mbytes MB\n"; close OUT; print "Finished $type...\n"; }

-OzzyOsbourne

Replies are listed 'Best First'.
(Ovid - Pseudo code. OT) Re(2): I have Wma file jammed in my regex
by Ovid (Cardinal) on Jan 19, 2001 at 21:34 UTC
    OzzyOsbourne wrote:
    I tried to find out what pseudo code was, but I think that that may have been some sort of insult.
    Pseudo-code is an informal "shorthand" method of designing a program. If you look in this post, you'll see two code samples, neither of which is code. The first is a primitive Warnier-Orr design and the second is a pseudo-code representation of a program of similar functionality. It's not an insult. Pseudo-code may be quite rigorous and strongly resemble the language that you plan to code in, or it may be very similar to natural language.
    while I read next line from file if line contains extension listed in my extension list write line to output file add one to lines copied else write line to error report add one to error count end if end while
    The above is a snippet of pseudo code that anyone who programs should be able to read. It's an easy way to understand your logic. After the pseudo-code is written, it's just a matter of translating to the finished output (preferably Perl :-)

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.