On 29 Jun 2001, Chas Owens <[EMAIL PROTECTED]> wrote,

> On 29 Jun 2001 11:31:51 +0200, BHEEKOO,KHALIL (HP-SouthAfrica,ex1)
> wrote:
> > Hi all
>
> Why do you think you need getlogin?  Getlogin does not accept any
> arguments and returns the name of the currently logged in user.  Are you
> looking for the uids of the users in @users?  If so then use a foreach
> loop like this:
>
> foreach $name (@users) {
>        print "$name has uid ", getpwnam($name), "\n";
> }

Beware, print takes LIST argument.  That way, you invoke getpwnam
in *list* context.  It only returns UID in *scalar* context.

    print "$name has uid ", scalar getpwnam $name, "\n";

or,
    my $uid = getpwnam $name;
    print "$name has uid $uid\n";


__END__
-- 
s::a::n->http(www.trabas.com)

Reply via email to