#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11148554 use warnings; use Lingua::StopWords qw(getStopWords); my %found; my $src = '/home/aleksandra/programu-testavimas/1-dk/trunk/tests/inputs/*.txt'; my $des = '/home/aleksandra/programu-testavimas/1-dk/trunk/tests/outputs/out.txt'; open(DES,'>',$des) or die $!; my $stopwords = getStopWords('en'); for my $file ( glob $src ) { open(SRC,'<',$file) or die "$! opening $file"; while( my $line = ){ ++$found{$_} for grep { !$stopwords->{$_} } split /\s+/, lc $line; } print DES $_, "\t\t", $found{$_}, $/ for sort keys %found; close(SRC); } close(DES);