Or you could use split and then paste together the pieces you need.my $filespec = "/usr/share/directory/piano_book.mp4"; my $relative = "." . $1 if $filespec =~ m{/usr/share(.*)};
But you'd most probably be better off with a specialized module such as Path::Tiny mentioned above or some other.
In reply to Re^3: How to cut the directory path?
by Laurent_R
in thread How to cut the directory path?
by aca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |