two ways to go about it:
chdir("path/to/dir") or die "$!";
opendir (DIR, ".") or die "$!";
my @files = grep {/students_.*?\.html/} readdir DIR;
close DIR;
{
local @ARGV = @files;
while(<>){
#each file will be read line by line here
}
}
opendir (DIR, "path/to/dir") or die "$!";
my @files = grep {/students_.*?\.html/} readdir DIR;
close DIR;
foreach my $file (@files) {
open(FH,"path/to/$file") or die "$!";
while (<FH>){
#read file line by line here
}
close(FH);
}
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
Offline 898 posts
since Mar 2006