Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: A regarding glob

by LanX (Canon)
on May 17, 2013 at 01:53 UTC ( #1033934=note: print w/ replies, xml ) Need Help??


in reply to Re^2: A regarding glob
in thread Q regarding glob

> Sorry if I didn't mention it clearly.

Sorry still not clear! (And unfortunately you didn't update your posts with code-tags either).

2 possibilities:

  • If you want the whole sub-path which fills into the wild-card, then the demonstrated code is already perfect. Try it out.

  • If you're only interested in the highest level folder do a @folders = split '/', $path for every path found by your glob and just take $folder[$index], where index is the number of folders in the "head" part.

    E.g 4 for "../../dir1/dir2/" will give you the next directory after "dir2".

HTH! =)

Cheers Rolf

( addicted to the Perl Programming Language)


Comment on Re^3: A regarding glob
Select or Download Code
Re^4: A regarding glob
by arunagiri (Initiate) on May 17, 2013 at 17:43 UTC

    I find the solution easier with both split and

     $element =~ m!dir1/dir2/(.*)/dir3/filename!;
      It's the same solution, just less abstract and therefore more vulnerable for typos and other errors!

      Good luck! =)

      Cheers Rolf

      ( addicted to the Perl Programming Language)

Re^4: A regarding glob
by arunagiri (Initiate) on May 17, 2013 at 17:44 UTC
    Thanks for your time.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033934]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-05 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls