- Perl ›
- builtin functions ›
- here
getpwuid function - get user information (user name)
To get the username , use the getpwuid function and the predefined variable $> as follows.
my $user = getpwuid($>);
You can get the user name by specifying the user ID in the argument of getpwuid.