411 REFERENCE · Wikibooks
Perl Programming/Keywords/getlogin
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Perl gethostent getnetbyaddr Keywords
The getlogin keyword
The getlogin function implements the same C library function. On most UNIX-like systems, this function returns the current login from /etc/utmp, if any. On an empty string, the function getpwuid should be used.
As getlogin is not as safe as getpwuid, the latter should be used for authentication.
Syntax
getlogin
Examples
$login = getlogin || getpwuid($<) || "Kilroy";
See also
getpwuid
Perl gethostent getnetbyaddr Keywords