"\hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated"
is a mistake:
Unrecognized escape P passed through at …
Unrecognized escape D passed through at …
Unrecognized escape p passed through at …
Unrecognized escape I passed through at …
Unrecognized escape C passed through at …
It evaluates to hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated
.
You want to single-quote the string in order to restrict backslash-escaping to backslashes and single quotes only. '\hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated'
evaluates to hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated
.
Let's properly escape the backslashes at the beginning so we get two backslashes. '\\hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated'
evaluates to \hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated
. This is the string you intended.
Now we can operate on the value.
my $var = '\\hydfs00PUBLIC1DEVpkumarITT_TEST_BUILDCS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated';
$var =~ s{ \ }{/}gx; # replace any single backslash with a single slash
# $var now has the value
# //hydfs00/PUBLIC1/DEV/pkumar/ITT_TEST_BUILD/CS2.1_PROD_TEST_40550_LG_LC_Java_sp36_obfuscated
This is all newbie stuff. Go learn the language, read a book or two.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…