Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Wise Elders,
I am but a serf on the monastery.. Wine pressing available by request.
When I read a directory contents into an array, and test the elements to find directories, it does not return directory values unless the path I am reading from is the local (.)
directory. WhatUp with that? If I remove the test, the correct contents are returned, the test just seems to fail.
updated by boo_radley :title change
#!/usr/bin/perl $path="."; opendir (DIR, $path) or die "could not open directory"; @files = readdir(DIR); foreach (@files) { print "$_ \n" if (-d $_) ; }
updated by boo_radley :title change
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Dumb or Cursed?
by ides (Deacon) on May 23, 2002 at 18:59 UTC | |
re : Problems with -filetest on readdir results
by boo_radley (Parson) on May 23, 2002 at 19:01 UTC | |
Re: Problems with -d filetest on readdir results
by cjf (Parson) on May 23, 2002 at 19:07 UTC | |
Re: Dumb or Cursed?
by choocroot (Friar) on May 23, 2002 at 19:07 UTC | |
Re: Dumb or Cursed?
by BazB (Priest) on May 23, 2002 at 18:59 UTC | |
Problems with -filetest on readdir results
by atopolc (Pilgrim) on May 24, 2002 at 03:11 UTC | |
by merlyn (Sage) on May 24, 2002 at 03:14 UTC |
Back to
Seekers of Perl Wisdom