#!/usr/bin/perl use strict; use warnings; my $file = "/root/Desktop/export_28-02-07.txt"; my @array; { local $/ = "\n#"; open my $fh, '<',$file or die $!; while( my $line = <$fh> ){ my @info = $line =~ /^suchmuster1 =(\d+)/; @info = $line =~ /^suchmuster2 (.+)/; @info = $line =~ /^suchmuster3 (Hallo)/i; @info = $line =~ /^suchmuster4 (Hello)/i; push @array, join(";", @info); } } foreach my $zeile (@array) { print $zeile."\n"; }