If you are manipulating URIs, use the URI module and its path_segments method.
If it is neither, simply use a regular expression that captures everything up to the last /.
'some/very/varied_length/string' =~ m|(.*/)| # expression returns ('some/very/varied_length/')
In reply to Re: accessing a part of a string
by Anonymous Monk
in thread accessing a part of a string
by uday_sagar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |