in reply to I go crazy with windows filenames with spaces!
In both snippets, right before opendir, print $path. You'll notice they're different.
is the same thing as"c:/documents\ and\ settings/username/desktop/perf_analyzer"
Both of the above produce the string"c:/documents and settings/username/desktop/perf_analyzer"
c:/documents and settings/username/desktop/perf_analyzer
Expressions that produce the string
would also be fine. Your bug isc:\documents and settings\username\desktop\perf_analyzer
You are causing the string to become$path=~s/\s{1}/\\ /g;
c:/documents\ and\ settings/username/desktop/perf_analyzer
That's bad, because there's no directory c:\documents
Fixed code:
chomp( my $path = `cd` ); opendir MYDIR, $path or die("Can't open dir $path: $!\n");
Even better:
opendir MYDIR, '.' or die("Can't open current dir: $!\n");
|
|---|