I sort of understand the question having seen it thrashed out in the CB over the last few days, but as it stands your question isn't easy to parse.
IIRC, you are looking for files that have a .ind extension (to use Win32 terminology), that also contain xxx or yyy in the pathname. My advice in the CB was to use File::Find... and this is how I'd do it:
use strict;
use File::Find;
my @patch;
find( sub {
next if $File::Find::name =~ /xxx|yyy/; # somewhere in the full na
+me
next unless /\.ind$/i; # just considering the file itself
push @patch, $File::Find::name;
},
shift || '.' # starting directory from command line, or current dir
);
That said, I have a particular aversion to building up a potentially huge array, if the only thing I am going to do afterwards is for( @patch ) { do_something() }. Rather than pushing it onto an array, I would just deal with it on the spot. Tread lightly on your machine, and it will serve you well.
Also note that $File::Find::name is the canonical name of the file e.g. /tmp/foo/bar/thing.ind, whereas $_ (in the context of find's callback sub) is merely thing.ind.
update: Duh! There was one other thing I meant to say. If 'xxx' or 'yyy' appears the name of a directory at the top of a very deep tree, the script will spend a lot of useless time delving into that tree for no purpose, since the first test will keep returning false. This calls for judicious use of the $File::Find::Prune variable, but that is either beyond the scope of this reply and/or left as an exercise to the reader!
--g r i n d e r
|