perl is parsing the backslashes correctly; backslashes are used as an escape character in string literals. You need 2 backslashes for each backslash in the resulting string.
print "\\\n"; # prints a \ and a newline
print "\\\\hostname" # prints \\hostname