in reply to A file in a directory
Related topics: glob, File::Find, File::Find::Rule (example below)@files = grep { /\errors.txt$/ && -f $_ }, @files;
Also, if you're going for just one specific file, no need to read the directory -- just check directly if the file exists:my @files = File::Find::Rule->file()->name('errors.txt')->maxdepth(1)- +>in($dir);
my $file = $dir . '/errors.txt'; push @files, $file if -f $file;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A file in a directory
by Anonymous Monk on Apr 24, 2006 at 19:26 UTC |