Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parent directory - regex

by davidj (Priest)
on Jun 17, 2004 at 12:39 UTC ( [id://367598]=note: print w/replies, xml ) Need Help??


in reply to Parent directory - regex

Here's a way to do it with a regex

#!\usr\bin\perl use strict; my $myDirectory; my $parent; $myDirectory = "/dir1/dir2/dir3/dir4/dirLast//"; # with '/' after dirLast ($parent) = $myDirectory =~ m#(.+)/#; print "$parent\n"; # without '/' after dirLast ($parent) = $myDirectory =~ m#(.+)//#; print "$parent\n"; exit;

davidj

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found