in reply to URL Regex Matching, again
You need anchor the regex to the end of the string to check if the last part of the string is bar optionally followed by a slash.
Your regex effectively matches any string containing bar not followed by a dot.$string =~ m|bar/?$/;
|
|---|