Monday, July 18, 2011

Convert unix path to windows path by converting frontslash to backslash

# Function Name : windowsSlash
# Input : String with or without slash
# Output : Path with double backslash
# Description : This function will convert all forward slash (/) to double backward slash(\\). Also,
# extra slashes will be removed.
#
sub windowsSlash($)
{
my ($str) = @_;
$str =~ s/\/\//\//g;
$str =~ s/\//\\\\/g;
return $str;
}

No comments:

Post a Comment