http://www.perlmonks.org?node_id=1025030


in reply to hash keys from another file

You do not need to load any file to an array. Just build a hash from the param file, then process the sent file line by line and output the count if you can find it:
#!/usr/bin/perl use warnings; use strict; my %counts; open my $PARAM, '<', 'param' or die "param: $!"; while (<$PARAM>) { my ($count, $word) = split; $counts{$word} = $count; } open my $SENT, '<', 'sent' or die "sent: $!"; while (<$SENT>) { chomp; print; print " $counts{$_}" if exists $counts{$_}; print "\n"; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ