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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.