in reply to Re: get directory listing
in thread get directory listing
That's because a simple glob will get you in trouble in production code. For example...
my @dirs=grep -d, </usr/darren/*>; # Whoa it's one line!!
Yeah it's on one line and looks elegant. Unfortunately there is no error control and it skips directories with a leading '.' in the name (e.g. '.foo', '..bar'). With readdir you need to be a little careful, but it works fine. If you aren't chdir'd into the directory you are reading you generally need to prepend the directory path to each name it returns, but that's trivial.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: get directory listing
by blazar (Canon) on Nov 08, 2005 at 16:52 UTC | |
by bluto (Curate) on Nov 08, 2005 at 19:35 UTC | |
by blazar (Canon) on Nov 09, 2005 at 14:36 UTC |