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 reply to Re^2: Assigning printf to a variable
by haukex
in thread Assigning printf to a variable
by viffer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |