in reply to Simulate file

There are several solutions:

The easiest is to change the call to open to something more suitable, like opening a scalar reference ("in-memory file"), as described in perlopentut.

If you absolutely don't want to modify the call to open(), you can replace open() with your own open() sub, which intercepts the opening process, and then returns an in-memory file handle instead. See perlsub for details (search for CORE::)

Another option is to use something like ptrace (not very portable) to intercept system calls to fopen. But that's probably really overkill.