in reply to pattern matching problem

It sounds like backreferences would do just what you want:
if ( $string =~ /\\\\([\w-]+)\\([\w-]+)/) { print"match: \$1=$1, \$2=$2\n"; }

I changed your regex to be closer to what you described in the text; it only matches letters, numbers, underscores, and - between the backslashes, and requires at least one character (something like \\\ would have passed your previous regex). If that's not what you want, change it back, but put parentheses around your .*'s.