in reply to get directory listing
opendir(DIRHANDLE,"/usr/darren") || die "file to open";
"file to open"?!? How 'bout $! anyway? (Check perldoc perlvar.)
Whatever, I really wonder why people insist so much in reinventing the wheel where a simple glob would do.
Is '.' fine? I mean: I'm not saying it is not. Simply generally people who reinvent the wheel do throw away it too...@FILES = grep !/^\.\.?$/, readdir DIRHANDLE;
By using the above method, will will get all the listing including the directory and files. how can i only show the directory in /usr/darren/?
-d is your friend. Check perldoc -f -X:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: get directory listing
by bluto (Curate) on Nov 08, 2005 at 16:31 UTC | |
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 |