Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; ... my $res_files = list_dirs($dir,$datanames); sub list_dirs { my @locations = shift; my @fnames = shift; =code # This is after DUMP of the data in here. my @locations = [ '/var/www/allfiles' ]; my @fnames = [ { 'filename' => 'abc122.txt' }, { 'filename' => '333twom.txt' }, { 'filename' => '56test.txt' }, { 'filename' => 't445ok.txt' } ]; =cut my @files; find( { wanted => sub { push @files, $_ unless $_ eq '.' || $_ eq '..' +|| $_ !~ m/@$fnames->{filename}$/} , no_chdir => 1 }, @locations); print Dumper \@files; return \@files; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing file names to search directories
by 1nickt (Canon) on Dec 28, 2016 at 20:00 UTC | |
by Anonymous Monk on Dec 28, 2016 at 20:45 UTC | |
by Anonymous Monk on Dec 28, 2016 at 21:07 UTC | |
|
Re: Passing file names to search directories
by FreeBeerReekingMonk (Deacon) on Dec 28, 2016 at 18:49 UTC | |
|
Re: Passing file names to search directories
by LanX (Saint) on Dec 28, 2016 at 18:12 UTC | |
by Anonymous Monk on Dec 28, 2016 at 18:44 UTC |