in reply to logger.cgi script - implementing one feature

Why not just:
... print MAINLOG "$_ $ENV{$_}\n" for keys %ENV; ...