in reply to Re: Assigning printf to a variable
in thread Assigning printf to a variable
local( *STDOUT ) = $fh;
Or select, though in this example local does have the advantage that it is restored after the block ends.
But in general, when wanting to capture STDOUT/ERR, I'd recommend Capture::Tiny.
In Section
Seekers of Perl Wisdom