#!/usr/bin/perl use strict; use warnings; my @test; push @test,'[Thu Nov 08 22:59:19 2012] [error] Hostname www.......de provided via SNI, but no hostname provided in HTTP request'; push @test,'[Fri Nov 09 09:49:30 2012] [error] [client 8.1.1.1] Can\'t modify constant item in scalar assignment at /script.pl line 16, near "\'schiess mich tot\';", referer: https://.......pl'; for (my $z = 0; $z < scalar @test; $z++) { print "Zeile $z: "; if ( $test[$z] =~ /^\[ ([^\]]+) # Datum \] \s+ \[ ([^\]]+) # Fehler \] \s+ (?>\[\S+\s([^\]]+)\]\s+)? # falls [client ...] Lookahead (.+) $ /x; ) { print "matcht 1=>$1< 2=>$2< 3=>$3< 4=>$4< 5=>$5< 6=>$6< 7=>$7<\n"; } else { print "matcht nicht\n"; } }