in reply to s/// and variable interpolation

I believe that what's happening is that when you use $ScriptPath in your regex, the backslashes are read as escaping the next character ... so essentially your regex is looking for the string "\SERVERCAPPBIN". Try changing the last line from
$file =~ s/$ScriptPath\\//;
to:
$file =~ s/\Q$ScriptPath\E\\//;
to tell the regex to treat those as literal backslashes and not as metacharacters.

~CubicSpline
"No one tosses a Dwarf!"