Hello everyone, I am working on my project where I should test my Perl program with different input files using GNU Makefile. My Perl code should read .txt files from the inputs directory, but right now it just reads only one specific file test.txt. Is it possible somehow to read all files from inputs directory and output to separate files in outputs directory? I tried to write inputs directory like this /path/to/file/*.txt but I guess it is not how it should be done.
EDIT: I am sorry, that's not how I wanted to explain my point. My Perl script should be executed with bash scripts (they are different for each case, it means they have each individual input) and then my Makefile should test all cases together.
This is my code
#!/usr/bin/perl use strict; use warnings; use Lingua::StopWords qw(getStopWords); my %found; my $src = '/home/aleksandra/programu-testavimas/1-dk/trunk/tests/input +s/test.txt'; my $des = '/home/aleksandra/programu-testavimas/1-dk/trunk/tests/outpu +ts/out.txt'; open(SRC,'<',$src) or die $!; open(DES,'>',$des) or die $!; my $stopwords = getStopWords('en'); 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 Perl wildcards in the file paths by cinnamond
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |