in reply to Re^2: open to a scalar variable
in thread open to a scalar variable
Putting together some of the other suggestions in this thread, I come up with this:
my $message = ''; open(MESSAGE, '+>>', \$message) or die "no message $!"; open(WHOM, '>>&=MESSAGE') or die "no whom $!"; open(WHAT, '>>&=MESSAGE') or die "no what $!"; print WHOM "I say 'whom'\n"; print WHAT "I say 'what'\n"; my $text; while (my $line = <MESSAGE>) { print $line; $text .= $line; } print $text; __END__ I say 'whom' I say 'what' I say 'whom' I say 'what'
|
|---|