sub printInformationWrapper { open (local *STDOUT,'>',\(my $var)); thing that prints to STDOUT return $var; }