Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Parent directory - regex

by periapt (Hermit)
on Jun 17, 2004 at 12:30 UTC ( [id://367596]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        my $path = "/dir1/dir2/dir3/ .. /dirn-1/dirLast//";
        my @pathary = split(/\//,$path);
    ...
    #    pop @path;                            # also
    #    my $parentpath = join('/',@pathary);  # works
        print "$path\n$parentpath\n";
    
  2. or download this
        use Cwd;
        my $oldpath = getcwd();
    ...
        $path = getcwd();
        print "$path\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 14:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found