in reply to Q regarding glob
So you are looking for the names of directories in dir2 that have subdirectories called dir3 and contain files called filename? Here it is:
use strict; use warnings; foreach my $element (glob "dir1/dir2/*/dir3/filename"){ print "$element: "; $element =~ m!dir1/dir2/(.*)/dir3/filename!; print "$1\n"; }
Comment: I left the ../../ out as it would not fit my sample dir structure I had to create. Without testing it, I would still say that you do NOT need to change the regex to make it work for your situation.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Q regarding glob
by arunagiri (Initiate) on May 17, 2013 at 17:40 UTC |
In Section
Seekers of Perl Wisdom