open(my $fh, ...); my $OLDFH; { $OLDFH = select($fh); print ...; ... } select($OLDFH);