in reply to Fetching last part of url
This is probably the safest way:
use URI; $uri = URI->new('http://domain.com/myurlinfo/mypage.html'); print(($uri->path_segments())[-1], "\n"); # prints "mypage.html"
Note that the slashes in the example URL you provided are leaning the wrong way and it doesn't have a domain even though it has a scheme. Mistakes like these and subtler ones are the reason it's usually better to use modules for parsing. The people who wrote the modules payed attention to the specs and the various possible formats.
|
|---|