in reply to regex a url

print $1 if /\/([^/?]+)(:?\?.*)?$/; But it is better to use joe++'s code and then print $1 if $path =~ /\/([^/]+)$/

Makeshifts last the longest.