in reply to replacing "\L" character in strings

"\" is special in string literals. You need to escape it.

$server = "SERVER05\\LDEV"; # Produces SERVER05\LDEV $server = 'SERVER05\\LDEV'; # Produces SERVER05\LDEV $server = 'SERVER05\LDEV'; # Produces SERVER05\LDEV

The third works since "\" only needs to be escaped when it's followed by another "\" or the string delimiter (') in single quoted strings.