On 29 Jun 2001 20:08:05 +0700, Hasanuddin Tamir wrote:
> 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)
Oops, I hate typos. The example was meant to be
foreach $name (@users) {
print "$name has uid " . getpwnam($name) . "\n";
}
The concat operators (.) would have forced getpwnam into scalar context.
--
Today is Setting Orange, the 34th day of Confusion in the YOLD 3167
Wibble.