while ( ) { push @lines, $_; my $Datum = $_ if m/Date: /; my $Zeit = $_ if m/Zeit: /; push @lines, $_; $Zeit =~ s/\D//g; #generierung von einem key my $dt = "serapis1".substr($Datum, 12, 4).substr($Datum, 9, 2).substr($Datum, 6, 2).$Zeit;       if ( /^\s*$/ ) {         if ($errorFound eq 1) {         my %hashref = ($dt => @lines);                 @lines = '';       $errorFound = 0;     }    }        $errorFound = 1 if /Severity: Error/;     m/NullPointerException/;    $LockedPinException++ if m/LockedPinException/;    $AuthenticationException++ if m/AuthenticationException/;        $Exception++ if m/\.Exception/;    $NoSuchElementException++ if m/NoSuchElementException/; $RemoteException++ if m/RemoteException/;         } while (($dt, @lines) = each %ENV) { print OUT "$dt => @lines\n"; }