>But man, that really seems like it's not fun. And all alternatives are
>bound to be longer than this:

>   my($a, $b, $c, $d, $e, $f) = getpwnam($user) || 'anonymous';

>Which is all I wanted to do in the first place! :-{

I do not think that that code that you have written there does what
you think that that code there is doing there.

That code assigns the new lexical variable $a to be the uid of the
user whose name is in $user--or else, failing that due to a bogus
return value or in the case of "root" which is going to be "0" and
annoy you (are we sure that we truly want string "0" forever false?),
it becomes "anonymous",

The other new lexical variables listed there are then antiïnitialized,
which in this case, has little distinguishing effect, but modulo
the my(), it could.

There is also peculiar situation that you're normally expecting a
numeric return, but have defaulted to a non-numerically valid string.
I suspect that was meant to be something like getpwuid($uid).

--tom

Reply via email to