Home  > Language reference > Functions > getlogin
Perl 5 version 32.0 documentation

getlogin

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage
  • 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.

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

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

    Portability issues: getlogin in perlport.

  • Site info

  • Docs mantained by Perl 5 Porters
  • Perldoc site development sponsored by OpusVL Logo
  • About PerlDOC
  • Manuals

  • Overview
  • Tutorials
  • FAQs
  • Changes
  • Reference

  • Language
  • Functions
  • Operators
  • Variables
  • Modules

  • Modules
  • Pragmas
  • Utilities
  • Misc

  • License
  • Internals
  • Platforms
  • About
perldoc.perl.org - Official documentation for the Perl programming language
This website is a Beta release. For any issues please raise a ticket on GitHub