#!/usr/bin/perl use strict; use warnings; use File::Find qw(finddepth); use File::Find qw(find); ... my ($dir,$datanames); # These var(s) has values been passed to the sub my $res_files = list_dirs($dir,$datanames); sub list_dirs { my @locations = shift; my $fnames = shift; my @files; find( { wanted => sub { push @files, $_ unless $_ eq '.' || $_ eq '..' +|| $_ !~ m/@$fnames->[0]{filename}$/} , no_chdir => 1 }, @locations); print Dumper \@files; return \@files; } # This is after DUMP of the data. =code my @locations = [ '/var/www/allfiles' ]; my $fnames = [ { 'filename' => 'abc122.txt' }, { 'filename' => '333twom.txt' }, { 'filename' => '56test.txt' }, { 'filename' => 't445ok.txt' } ]; =cut
In reply to Re^2: Passing file names to search directories
by Anonymous Monk
in thread Passing file names to search directories
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |