Copyright © tutorialspoint.com

PERL getlogin Function


Syntax

getlogin


Definition and Usage

Returns the user's name, as discovered by the system function getlogin( ). Under Windows, use the Win32::LoginName( ) function instead.

Return Value

  • undef on failure

  • User's login name

Example

Try following example:

#!/usr/bin/perl

$login = getlogin || getpwuid($<) || "TutorialsPoint";

print "Login ID is $login\n";


Copyright © tutorialspoint.com