my $re = qr{^.+?(SPort=)(\d+\s)(DIP=)(\d+.\d+.\d+.\d+\s)(DPort=)(\d+\s)(TP=)(\w+\s)(;)(\s)(\w+)}; # Regex erzeugen if ( my @fields = ($line =~ $re) ) { # falls Regex in $re matcht, gecaptureted Felder (="Klammerausdrücke" des Regex) in @fields speichern # hier @fields weiter bearbeiten }