open my $fh, '<',$file or die $!; while( my $line = <$fh> ){ chomp($line); my @info = $line =~ /^suchmuster1=(\d+)/; push @info, $line =~ /^suchmuster2: (.+)/; push @info, $line =~ /^suchmuster3: (test1)/i; push @info, $line =~ /^suchmuster4: (test2)/i; push @info, $line =~ /^suchmuster5: (test3)/i; push @info, $line =~ /^suchmuster6: (test4)/i; my $new_line = join(";",@info); print $new_line."\n"; }