Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Parent directory - regex

by gawatkins (Monsignor)
on Jun 17, 2004 at 12:05 UTC ( #367588=note: print w/ replies, xml ) Need Help??


in reply to Parent directory - regex

Here is an example of a simple script to do this without using regex:

#!\usr\bin\perl use strict; my $myDirectory = "/dir1/dir2/dir3/dir4/dirLast//"; my @myDir = split('/', $myDirectory); #creates an array of Dir names pop @myDir; #removes the currnet directory $myDirectory = join( '/', @myDir); #Joins names back into parent path print $myDirectory;

Thanks,
Greg W


Comment on Re: Parent directory - regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2015-07-30 10:31 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 (271 votes), past polls