use Win32::EventLog::Message; Win32::EventLog::Message::RegisterSource( 'Application', $prog ); my $event = Win32::EventLog->new($prog) || die "Can't open Event log!\n"; use Win32::EventLog::Carp { Source => $prog }; if ($DEBUG) { Win32::EventLog::Carp::carp "I'm carping, this should be in the eventlog and on the console"; } sub Log { my $msg = shift; $event->Report( { EventID => 0, Strings => $msg, EventType => "Information", } ); $mailmessage .= "$msg\n"; }