To create a "RAM based directory" is more of a task for an operating-system than a program. Really, you'd need to mount a new type of file-system (there may be support for some existing RAM-disk-based file-system in your OS or not).
What you have the option of doing inside your program is to not go to the file-system at all, which is what various perl constructs such as IO::Scalar and the similar builtin functionality in 5.8 do.
------------
:Wq
Not an editor command: Wq