http://www.perlmonks.org?node_id=229470


in reply to shell to perl

The code below will give you the same output as "whoami" without having to make a system call.

my $id = (getpwuid($<))[0]; print qq($id\n);

«Rich36»