in reply to A question on Regex

you need to anchor it to the end of line, like so:
if($mystring =~ m!([^/]+$)!){ #note the $ character added