STDOUT et al.

Jeff Klein jeffk at pcr7.pcr.com
Wed Jan 26 15:31:07 CST 2000


This works.

use IO::File;
$fh = IO::File->new_tmpfile();

open(SAVE, ">&STDOUT") or die $!;
open(STDOUT, ">&${\fileno $fh}") or die $!;
$| = 1;

print "This text is going nowhere...\n";
print STDOUT "Neither is this...\n";

open(STDOUT, ">&SAVE");
close(SAVE);
print "STDOUT reopened.\n";

seek $fh, 0, 0;
while (<$fh>) {
   print;
}

close $fh;



More information about the grand-rapids-pm-list mailing list