parsing multiple files in perl?

Hybride

New member
I have 10 separate Prolog files in my directory that need to be put into an array and have each file's contents parsed into one giant string or file, that gets read by AI::Prolog. I can get the loop to grab all the necessary files in the directory, print out that the files exist, but when I try to actually get the content, I get a "file does not exist error". Here's my code, using FILE::Util

my @pFiles = $f->list_dir('cgi-bin/', '--pattern=\.pl$');

my $prologRules = "";
foreach my $file (@pFiles) {
open(PROLOGFILE, $file) or die "$! \n";
while(<PROLOGFILE>) {
local $/;
$prologRules = read_file($file);
}
}
my $prolog = AI::Prolog->new($prologRules);
 
Back
Top