#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $file = 'C:/Programme/UrbanTerror/q3ut4/games.log'; my %proc = ( 'ClientConnect' => sub{ print "Client $_[0] connected\n" }, 'ClientBegin' => sub{ print "Client $_[0] began\n" }, 'ClientUserinfo' => sub{ my $line = shift; if ( $line =~ /(\d+) \\(.*)/ ) { print "Client $1: $2\n"; my $logline = $2; my %player_info = $logline =~ m! / ([^/]+) / ([^/]+) !xg; print Dumper \%player_info; } # if }, ); open( my $fh, '<', $file ) or die "Cannot open file '$file': $!"; while ( my $line = <$fh> ) { chomp($line); if ( $line =~ /^\s+(\d{1,2}:\d{2}) ((\w+):(?: )?(.*)?)/ ) { #my $time = $1; # findet keine verwendung $proc{$3}->($4) if defined $3 and defined $4; } # if } # while __END__