in reply to Re: Problem stripping directory listing
in thread Problem stripping directory listing

zengargoyle++ for that. But I don't see why it's necessary to chdir to the directory just to read it. Also, IO::Dir makes things somewhat easier.
use IO::Dir; my @users = (IO::Dir->new($home) or die "$home: $!")->read; print join "\n", @users, '';
Update: thanks to zengargoyle's note below. Ooops!
my @users = grep { !/^\./ and -d "$home/$_" } (IO::Dir->new($home) or die "$home: $!")->read;

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.

Replies are listed 'Best First'.
Re: Re: Re: Problem stripping directory listing
by zengargoyle (Deacon) on Feb 15, 2003 at 14:02 UTC

    chdir was so i didn't have to do -d "$home/$_" for everything.. your solution would likely include . and .. and any files that happened to be loitering around. not that this is likely the best way to find a list of users anyways =P