while (my $line1 = <$fhone>) { my ($key,@attributes1) = split $line1; my $attrib_ref2 = $hash{key}; # 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 print $fhout join(' ',$key,@$attrib_ref2,grep {!$filter_attrib{$_}} @attributes1)."\n"; }