barathbr has asked for the wisdom of the Perl Monks concerning the following question:
Pl. note that when I try to read the same directory with something like this, everything is fineopendir(ODIR,"c:/") || die "Cannot open this directory: $!"; while($name=readdir(ODIR)) { print "## inside while\n"; if(-d $name) { print "## inside if \n"; # ... # ... } }
Thanks in advance ..while (<c:/*>) { if (-d) { print "$_ is a directory\n" } else { print "$_ is a file\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: odd behaviour with opendir()
by gellyfish (Monsignor) on Nov 04, 2004 at 10:02 UTC | |
by barathbr (Scribe) on Nov 04, 2004 at 10:58 UTC |