You are viewing the version of this documentation from Perl blead. This is the main development branch of Perl. (git commit e49de0c3a4d0a4f000e7edb2711fab12649ea73b)
getlogin

This implements the C library function of the same name, which on most systems returns the current login from /etc/utmp, if any. If it returns the empty string, use getpwuid.

my $login = getlogin || getpwuid($<) || "Kilroy";

Do not consider getlogin for authentication: it is not as secure as getpwuid.

Portability issues: "getlogin" in perlport.