while ( ) {               $Datum = $_ if m/Date: /; $Zeit = $_ if m/Time: /; $errorFound = 1 if /Severity: Error/; $lines .= $_;              #generate a new hash-hey   if ($Zeit && $Datum && $errorFound){                $Zeit  =~ s/\D//g;        $Datum =~ m/(\d+)\.(\d+)\.(\d+)/g; $dt    =  $3.$2.$1.$Zeit."_".$ARGV[0]; $Datum =  $Zeit = "";         }    #put the error snippel in hash    if (/^\s*$/ or eof) {             $hash{$dt}  = $lines if $errorFound; $errorFound = 0; $lines      = ''        } }     close dat1; while ( ) {       $Datum = $_ if m/Date: /; $Zeit = $_ if m/Time: /; $errorFound = 1 if /Severity: Error/; $lines .= $_;              #generate a new hash-hey   if ($Zeit && $Datum && $errorFound){                $Zeit  =~ s/\D//g;        $Datum =~ m/(\d+)\.(\d+)\.(\d+)/g; $dt    =  $3.$2.$1.$Zeit."_".$ARGV[1]; $Datum =  $Zeit = "";        }    #put the error snippel in hash    if (/^\s*$/ or eof) {           $hash{$dt}  = $lines if $errorFound; $errorFound = 0; $lines      = ''        } close dat2;