in reply to pretending that the contents of a variable are files

If the program in question can read from stdin, a quick and dirty, although non-portable and non-scalable solution is the following:
$output = `anotherprogram <<END_OF_DATA\n$lots_of_data\nEND_OF_DATA`;
In my tests on Linux, it works for up to about 100 KB of data.