There is also glob which would look something like this (untested)
#!/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/input +s/*.txt'; my $des = '/home/aleksandra/programu-testavimas/1-dk/trunk/tests/outpu +ts/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 = <SRC>){ ++$found{$_} for grep { !$stopwords->{$_} } split /\s+/, lc $line; } print DES $_, "\t\t", $found{$_}, $/ for sort keys %found; close(SRC); } close(DES);
In reply to Re: Perl wildcards in the file paths
by tybalt89
in thread Perl wildcards in the file paths
by cinnamond
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |