You say that the files of interest don't have an extension, but your grep is matching only files with the extension .txt. The first step is to change your grep to:
my @files = grep /^R/, readdir( DIR );
to match files that start with R. The ^ matches the start of the string thus the R requires that the first character be R. When you have the correct list of files the open should be trivial, but remember that the names returned by readdir don't include the directory path so, if the files are not in the current working directory, you will need to prefix $directory to the file names in the open. Probably something like:
for my $filename (@files) { open my $inFile, '<', "$directory/$filename" or die "Can't open $d +irectory/$filename: $!"; ... close $inFile; }
In reply to Re: Reading specific files
by GrandFather
in thread Reading specific files
by molson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |