Here is an example of a simple script to do this without using regex:
Thanks,#!\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;
In reply to Re: Parent directory - regex
by gawatkins
in thread Parent directory - regex
by jevon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |