$ScriptPath = "\\\\SERVER\\C\$\\APP\\BIN"; $file = "$ScriptPath\\somefile.txt"; $file =~ s/$ScriptPath\\//;