Retrieve the username which got authenticated by the apache

I have an apache 2.2 setup with LDAP auth enabled. The html form in the front end takes some values and processes them using perl script in the background. Is there a way I can get the username which is submitting the values in that perl script. I am planning to track who is doing what(with the values they submit) in a more better way in a file than the usual access_log.

I tried using the below in my perl script, but no luck. Any help would be much appreciated.

my $userId = $_SERVER['AUTHENTICATE_SAMACCOUNTNAME'];
print " I am $userId";

Have you tried $_SESSION['userPrincipalName']