Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Q regarding glob

by hdb (Prior)
on May 17, 2013 at 09:34 UTC ( #1033958=note: print w/replies, xml ) Need Help??


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
    Works like a charm. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033958]
help
Chatterbox?
[1nickt]: Corion HPs? ugh. I was impressed with Lenovo's gaming laptops; if it weren't for the red backlighting and general flashiness of the aesthetic, I might have gone with that. But all that was until I discovered that the Dell Precision line is still around.
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;
[1nickt]: I though the gamers like that because they bash the keys so hard.
[ambrus]: and I've seen motherboards with no fast expansion ports for a video card but built-in hardware RAID advertized as "gaming".
LanX has a shaming laptop
[ambrus]: 1nickt: my impression is that the gamers like the softer springs, because fast reaction time is more important to them then feedback from keypresses to recognize typos.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2017-03-27 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.