in reply to UID 0 and getpwnam

Couldn't you use if( defined $uid)?