use strict; use Lingua::Stem::Snowball; my $idea  = 'books'; my %words = ( 'books'        => 5,              'library'       => 6,              'librarianship' => 5,              'librarians'    => 3,              'librarian'     => 3,              'book'          => 3,              'museums'       => 2            ); my $stemmer   = Lingua::Stem::Snowball->new( lang => 'en' ); my $idea_stem = $stemmer->stem( $idea ); print "$idea ($idea_stem)\n"; my $total = 0; foreach my $word ( keys %words ) {  my $word_stem = $stemmer->stem( $word );  print "\t$word ($word_stem)\n";  if ( $idea_stem eq $word_stem ) { $total += $words{ $word } } } print "$total\n";