#!/usr/local/bin/perl use strict; my %hash = (); my @text; open (AN, $ARGV[0] ) or die "$!\n"; open (IN, $ARGV[1]) or die "$!\n"; while (my $line = ) { chomp $line; my ($k, $v) = split / /, $line; $hash{$k} = $v; } my @vector = keys %hash; wort_zu_zahl (); sub wort_zu_zahl { while () { chomp; push (@text, split /\n/); } for my $line( @text ) { chomp $line; my @words = split / /, $line; my %local = (); $local{$_} += $hash{$_} for @words; print join(",", map $local{$_} || 0, @vector),,"\n"; } }