I need the to convert the input address to specified format
#!/usr/bin/perl
my $file_path =\"\\\\\\abc.com\\a\\t\\temp\\L\\\\\";
#---- Help in this regex
$file_
What you seem want to do is collapse every occurrence of \\
to \
. However, you need to escape every occurrence of \
when you actually use it in your regexp, like so:
use strict; use warnings;
my $a = '\\\abc.com\a\t\temp\L\\';
# match \\\\ and replace with \\
(my $b = $a) =~ s/\\\\/\\/g;
print $b . "\n";
...which yields the literal string:
\abc.com\a\t\temp\L\
Note that I did not specify the input string with double quotes as you did. It is not entirely clear what the literal string is that you are starting with, as if it is specified with double quotes, it needs to have more backslashes (every two backslashes becomes one). See the discussion of interpolation under perldoc perlop, as I mentioned in an answer to your other question.