On Fri, Oct 22, 2021 at 11:12 AM Tom Molesworth via perl5-porters < perl5-porters@perl.org> wrote: > On Fri, 22 Oct 2021 at 22:50, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> > wrote: > >> I propose the addition of a new perlvar; perhaps named >> >> { >> local ${^OUTPUT_HANDLE} = $newh; >> print "Things"; >> } >> > > Wouldn't the existing STDOUT local() support be more clear for this case? > It also has the advantage of working equivalently for STDERR/warn: > > { > local *STDOUT = $newh; > print "Redirected"; > } > { > local *STDERR = $newh; > warn "Also redirected"; > } > > Or is this aimed more at format-related functionality? > Replacing superglobals wholesale is a bit different from select, which still would allow you to print to STDOUT while selecting a different default handle. -DanThread Previous | Thread Next