in reply to Getting Filehandle from Mail::Mailer

Many thanks to chromatic btrott and even BBQ. My partner is still having trouble and so sends along this message
Yes I can print() to $mailer but I cannot write() to it. Here are the errors.
Write on closed filehandle at ./format_eg.pl line 77.
Write on closed filehandle at ./format_eg.pl line 78.
Lines 77 and 78 are the two write statements in the code below. The code works on STDOUT and a normal file. Here is the code.
sub Write_Data{ format STDOUT = @<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<< shift(@printrows), shift(@printrows), shift(@printrows), shift(@printrows) . my $To = 'dvmrgn@home.com'; my %mail_header = ('To', $To, 'From', 'webmaster@onlinerenter.com', 'Subject', 'Test of New Clients Report'); my $mailer = new Mail::Mailer 'smtp', Server=>'smtp.telusplanet.net'; $mailer->open(\%mail_header); my $ofh = select($mailer); $~ = "STDOUT"; write ; write ; $mailer->close; select($ofh); } # End of write_data
Please thank everyone for their help and I hope someone has an insight to it.
There endeth the q uestion. TIA
Tony