use IO::Scalar; my $data; tie *HACK, 'IO::Scalar', \$data; print HACK ; tied(*HACK)->setpos(0); *STDIN = *HACK;