Gretter has asked for the wisdom of the Perl Monks concerning the following question:
Some sub-directories and files have white spaces in their names. The following test failes on those:
Problem solved:
What can I do to find the sub-directories and subsequently open them, even when they have white spaces?foreach(@dir) { if (-d$_) {print $_," is a directory.\n"; }
Problem solved:
The solution was to specify the entire path.foreach(@dir) { my $subdir = $dir.$_; if (-d$_) {print $_," is a directory.\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: if (-d$_) failes because of white space
by Anonymous Monk on May 13, 2009 at 11:18 UTC | |
Re: if (-d$_) failes because of white space
by cdarke (Prior) on May 13, 2009 at 11:35 UTC | |
Re: if (-d$_) failes because of white space
by Utilitarian (Vicar) on May 13, 2009 at 12:07 UTC | |
Re: if (-d$_) failes because of white space
by leocharre (Priest) on May 13, 2009 at 15:09 UTC | |
Re: if (-d$_) failes because of white space
by ikegami (Patriarch) on May 13, 2009 at 16:08 UTC | |
Re: if (-d$_) failes because of white space
by radiantmatrix (Parson) on May 13, 2009 at 15:53 UTC | |
Re: if (-d$_) failes because of white space
by Gretter (Novice) on May 13, 2009 at 15:54 UTC | |
by almut (Canon) on May 13, 2009 at 19:05 UTC | |
Re: if (-d$_) failes because of white space
by nimdokk (Vicar) on May 13, 2009 at 18:44 UTC |
Back to
Seekers of Perl Wisdom