in reply to How to cut the directory path?
If what is wanted is really the lowest level directory plus file name, try this:
my $filespec = '/usr/share/directory/piano_book.mp4'; my @parts = split /\//, $filespec; my $relative = './' . join '/', splice @parts,-2,2;
|
|---|