my $fileno = fileno( $foo ); open STDIN, ">&$fileno" or die "Could not open $fileno: $!";