my $script = 'while() { print; }'; close(STDIN); open (STDIN,'<',\my $stdin); my $script_input = 'blah'; $stdin .= $script_input; eval $script;