in reply to Logging through a .htaccess dialog

If you are using the CGI module:
use CGI; $username = CGI->remote_user();

Or the Environmental variable:
 $username = $ENV{'REMOTE_USER'}