use IO::Scalar; my ( $STD1 $STD2 ); $STD1 = new IO::Scalar \$STD2; select $STD1; print <test.txt"; print FILE $STD2; close FILE;