girarde has asked for the wisdom of the Perl Monks concerning the following question:
open(MESSAGE, "+>>", "\$message") or die "no message $!"; open(WHOM, ">>", "&=MESSAGE") or die "no whom $!"; open (WHAT, ">>", "&=MESSAGE") or die "no what $!";
after which much is written to the handles using various formats, and an attempt to get the data is made so:
while (my $line = <MESSAGE>) { print $line; $text .= $line; } print $text;
The result is:
Use of uninitialized value in print at check_remove.pl line 85.
where line 85 is the print $text line. Opening MESSAGE in different modes does not yield better results. For instance, using the syntax in the open manpage results in a Filehandle MESSAGE opened only for output error. It works OK if I omit the handles and point the formats at STDOUT, but I am on Win32 and want to mail the output, so piping the output to SENDMAIL won't help. I was going to use Mail::Sendmail, which is why I want the output in a scalar. What am I missing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open to a scalar variable
by kyle (Abbot) on Jun 04, 2007 at 21:53 UTC | |
by girarde (Hermit) on Jun 05, 2007 at 13:56 UTC | |
by kyle (Abbot) on Jun 05, 2007 at 14:17 UTC | |
|
Re: open to a scalar variable
by almut (Canon) on Jun 04, 2007 at 22:35 UTC | |
by girarde (Hermit) on Jun 05, 2007 at 14:04 UTC | |
|
Re: open to a scalar variable
by kwaping (Priest) on Jun 04, 2007 at 21:55 UTC | |
by girarde (Hermit) on Jun 05, 2007 at 14:04 UTC |