The () around $thisj make the following = be interpreted as a list assignment, so the thing after the = (the match on $dir) is given list context, and $thisj is assigned the first (and only, in this case) element of the list returned by the match. See m/PATTERN/ in
http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators-operator%2c-regexp for what a regex match returns in list vs. scalar context.
m introduces a regex to be used for matching; whatever follows it is the delimeter around the regex. m!/([^/]+)$! would be exactly the same, as would m/\/([^\/]+)$/ (note that with / as the delimeter, /'s in the regex need to be escaped with \).