in reply to To get file names from the search string
For example with a combination of readdir and grep:
my $dirname= '/some/directory/with/files'; my $input= '2013-09-04'; opendir my $dh, $dirname or die "Couldn't read '$dirname': $!"; my @found= grep /^\Q$input\E/, readdir $dh; ...
In my opinion the easiest way is to use File::Glob::bsd_glob:
use File::Glob qw( bsd_glob ); my @found= bsd_glob("$input*");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To get file names from the search string
by RichardK (Parson) on Sep 05, 2013 at 14:30 UTC |