$lineCount = 1; while (my $line1 = <$fhone>) { chomp $line1; my ($key,@attributes1) = split (/\s+|\t/,$line1); my $attrib_ref2 = $hash{$key.$lineCount}; # Hash um Attribute die in File2 vorkamen aus der Attribut-Liste in File1 rauszufiltern my %filter_attrib = map {$_ => 1}@$attrib_ref2; # Zeile mit Key, Attribute aus File2, gefilterte Attribute aus File1 ausgeben $lineCount++; print $fhout join(' ', $key, @$attrib_ref2, grep {!$filter_attrib{$_}} @attributes1)."\n"; }