---- CODE BLOCK ---- { if($opt_mailto) { $mail_obj = VNI::Mailer->new(); $mail_obj->to($opt_mailto); $mail_obj->subject($report_title); $mail_obj->from($from); $message = $mail_obj->open(); } else { $message = *STDOUT; } # select whatever filehandle is in $message for output select($message); # -- further down format MSG_TOP = blah some header for this report --------------------------------- . format MSG = @<<<<< @<<<<<< @<<<<<< @<<<<<< $foo, $bar, $baz, $quux ------------------------------ . $^ = "MSG_TOP"; $~ = "MSG"; foreach (@lusers) { $foo = $_->data; $bar =$_->otherdata; # etc, etc, # THIS WRITE WORKS WHEN $message == *STDOUT # OUTPUT DISAPPEARS OTHERWISE write($message); } # The following prints always work correctly. print $message "Some summary info: $balance\n"; print $message "People who suck: $sucky\n"; } ----- END CODE ----