%hash = (); open (AN, $ARGV[0] ) or die "Not Found\n"; open (IN, $ARGV[1]) or die "Not Found\n"; while ($line = ) { chomp $line; ($k, $v) = split / /, $line; $hash{$k} = $v; } while () { chomp; push (@text, split /\n/); # warum split, Zeilentrenner ist doch schon "\n" } for $sentence ( @text ) { @word = split / /, $sentence; # wort zu zahl $_=$hash{$_} for @word; # auffüllen push(@word,0) while(@word < 5); print join(','@word)."\n"; }