in reply to What is the best way to find username running your script?
my $username = getpwuid($<); [download]
Not sure how well it does on MSWin32.