Couldn't you use if( defined $uid)?
In reply to Re: UID 0 and getpwnam by mirod in thread UID 0 and getpwnam by c