Another possibility:
($rootdir,$userdir) = split '//', $dir;
Caveat: it looks like a string but is treated like a regex, meaning special characters like ., *, $, etc. are still special (have their normal regex meaning). But / is not special, so no problem there.
The slash / is special in your code, as it delimits the regex, cf. Tomte's post on how to choose different regex delimiter.
-- Hofmator