in reply to open to a scalar variable
and an attempt to get the data is made so: ...
Why do you need to get at the data in $message by reading from the associated filehandle? (seems like a rather cumbersome way to copy a string from one variable to another... :)
But if you really insist on doing that way, I suppose you have to reset the filepointer to the beginning before reading, e.g.
use strict; use warnings; open my $msg, "+>", \my $message or die "no message $!"; print $msg " foo\n"; print $msg " bar\n"; print "\$message:\n$message"; seek $msg, 0, 0; # reset filepointer my $text; while (my $line = <$msg>) { $text .= $line; } print "\$text:\n$text";
Output:
$message: foo bar $text: foo bar
In other words, once you have the mail in $message, why not pass it directly to Mail::Sendmail...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: open to a scalar variable
by girarde (Hermit) on Jun 05, 2007 at 14:04 UTC |