>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
- Re: RFC 212 (v1) Make length(@arr... Damian Conway
- Re: RFC 212 (v1) Make length(@array) w... Casey R. Tweten
- Re: RFC 212 (v1) Make length(@arr... Nathan Torkington
- Re: RFC 212 (v1) Make length(... Casey R. Tweten
- Re: RFC 212 (v1) Make length(... Randal L. Schwartz
- Uninitialized value warnings ... Nathan Wiger
- Re: Uninitialized value warni... Nathan Torkington
- Re: Uninitialized value warni... Nathan Wiger
- Re: Uninitialized value warni... Michael Fowler
- Re: Uninitialized value warni... Tom Christiansen
- Re: Uninitialized value warni... Tom Christiansen
- Re: Uninitialized value warni... Bart Lateur
- Re: RFC 212 (v1) Make length(@array) w... David L. Nicol
- Re: RFC 212 (v1) Make length(@array) work Johan Vromans
- Re: RFC 212 (v1) Make length(@array) work Graham Barr
- Re: RFC 212 (v1) Make length(@array) work Damian Conway
- Re: RFC 212 (v1) Make length(@array) work Nathan Torkington
- Re: RFC 212 (v1) Make length(@array) work Damian Conway
- Re: RFC 212 (v1) Make length(@array) work Bart Lateur
- Re: RFC 212 (v1) Make length(@array) work Dave Storrs
- Re: RFC 212 (v1) Make length(@array) work Bart Lateur
