On Fri, Jun 13, 2003 at 12:28:47PM -0500, James Edward Gray II wrote:
> On Friday, June 13, 2003, at 12:01 PM, [EMAIL PROTECTED] wrote:
>
> >my @user=(split(/:/,(@passwd=(split(/\n/,`cat /etc/passwd`)))[0]));
>
> I'm not 100% sure how your /etc/passwd is formatted, but if the name is
> before the first colon and the password is after, we could populate a
> hash with something like:
>
> my %users = map { (split /:/, $_)[0, 1] } grep !/^#/, split /\n/, `cat
> /etc/passwd`;
That could be a little bit more compact:
my %users = map +(split /:/)[0,1], grep !/^#/, `cat /etc/passwd`;
Or even:
my %users;
$users{$a} = $b while ($a,$b) = getpwent;
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]