m0ve has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl # # AUTOWEAPONBANS N BANLISTCLEANER # V 1.1 # ############################################ use strict; use warnings; use Data::Dumper; use utf8; binmode(STDOUT, ":encoding(UTF8)"); binmode(STDIN, ":encoding(UTF8)"); our (@steam,@name,@scout,@awp,@date,@time); our %players=([@steam],[@name],[@scout],[@awp]); my $datei1 = "banned.cfg"; my $pfad1 = "H:\\perl\\uebungen\\save\\pme\\logparsing\\srcds1\\"; our $file1 = "$pfad1$datei1"; my $datei2 = "banned.cfg"; my $pfad2 = "H:\\perl\\uebungen\\save\\pme\\logparsing\\srcds2\\"; our $file2 = "$pfad2$datei2"; our $infofile = "info.txt"; { package main; &Scan; &Readinfo("$infofile"); &Read("$file1"); &Read("$file2"); &Write("$file1"); &Write("$file2"); &Writeinfo("$infofile"); #print Dumper (%players); } ###################################################################### +############################# # logfile auswerten ###################################################################### +############################# sub Scan { my $file = $ARGV[0]; my ($line); my $steam; my @oldbans; if (!$file) { print STDERR "\n\t KEIN LOGFILE ANGEGEBEN !\n\n"; exit(); } open(LOG, $file) or die ("\n\tPFAD/FILENAME FALSCH ? \n\nLogfile konnt +e nicht geoeffnet werden"); #$file öffnen while(<LOG>) { #$file zeilenweise auslesen chomp(); $line = $_; my $time = substr($line,2,21); #zeit extrahieren if(substr($line,25,1) eq "\"") #auf """ prüfen (pla +yeraction) { $steam = substr($line,index("$line","STEAM_0:",32),(index("$li +ne",">",index("$line","STEAM_0:",32)) -index("$line","STEAM_0:",32))); if(index("$line","with \"scout\"",32) != -1) { # scou +tkills suchen $players{$steam}{$time} = "scout"; $players{$steam}{'info'} = "restricted wea +pon use"; } if(index("$line","with \"awp\"",32) != -1) { # awpk +ills suchen $players{$steam}{$time} = "AWP"; $players{$steam}{'info'} = "restricted wea +pon use"; } } } close(LOG); #print Dumper (%players); } [...more subs...]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problems opening logfile
by Corion (Patriarch) on Aug 10, 2007 at 09:19 UTC | |
by m0ve (Scribe) on Aug 10, 2007 at 09:25 UTC | |
by Corion (Patriarch) on Aug 10, 2007 at 09:27 UTC | |
by m0ve (Scribe) on Aug 10, 2007 at 09:36 UTC | |
|
Re: problems opening logfile
by FunkyMonk (Bishop) on Aug 10, 2007 at 09:17 UTC | |
by m0ve (Scribe) on Aug 10, 2007 at 09:22 UTC | |
by FunkyMonk (Bishop) on Aug 10, 2007 at 09:26 UTC | |
by m0ve (Scribe) on Aug 10, 2007 at 09:30 UTC | |
by technojosh (Priest) on Aug 10, 2007 at 15:13 UTC |