opendir MYDIR, ("c:/documents\ and\ settings/username/desktop/perf_analyzer"); print "Path:\n$path\n"; while ( $file = readdir(MYDIR)) { print "File: ", $file, "\n"; } #### $path = `cd`; # I am in c:/documents\ and\ settings/username/desktop/perf_analyzer $path=~s/\\/\//g; chop $path; #Why there is a space at the end??? I have to chop it or else I will have extra backslash after second substitution... $path=~s/\s{1}/\\ /g; opendir MYDIR, $path; # Yes I have the path exactly like in previous code but it doesn't browse the directory. I even tried to add the same qoutes ('"'.$path.'"') but it didn't work either. print "Path:\n$path\n"; while ( $file = readdir(MYDIR)) { print "File: ", $file, "\n"; }