Look at this:
- $string = "D:\Folder\TEST\abc.txt";
-
print $string;
the output is:
D:FolderTEST.bc.txt
notice there are no backslashes to substitute with forward slashes. The backslash in a double-quoted string is an escape character, not a literal backslash. You ned to use single-quotes:
- $string = 'D:\Folder\TEST\abc.txt';
Are you trying to parse Windows filepaths on a Linux/Unix box?
From File::Basname:
<start quote>
fileparse_set_fstype
my $type = fileparse_set_fstype();
my $previous_type = fileparse_set_fstype($type);
Normally File::Basename will assume a file path type native to your current operating system (ie. /foo/bar style on Unix, \foo\bar on Windows, etc...). With this function you can override that assumption.
Valid $types are "MacOS", "VMS", "AmigaOS", "OS2", "RISCOS", "MSWin32", "DOS" (also "MSDOS" for backwards bug compatibility), "Epoc" and "Unix" (all case-insensitive). If an unrecognized $type is given "Unix" will be assumed.
<end quote>