Perl Monk, Perl Meditation | |
PerlMonks |
Regular Expression Helpby Anonymous Monk |
on Nov 18, 2005 at 19:50 UTC ( [id://509925]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Let's say you have a directory: /rootdir/sub1/sub2/sub3/sub4/ How would I strip off JUST the last subdir, sub4? Of course, the dir could be called anything, like "/rootdir/sub funky ---doodash/la la la/Proposal for Buttering My Feet" and I would still want to strip off "Proposal for Buttering My Feet", and be 5 or more times long. Any idea? I figure it's a reg ex like "Look for the last / that isn't the last character and take away everything to the right of it, including itself" Thanks very much!!!!
Back to
Seekers of Perl Wisdom
|
|