in reply to VI In A Perl Script

As you might know, open3 only allows to interface with another program via the standard file handles (stdin,stdout,stderr), so you'd hit a brick wall rather soon, in case you'd need to go beyond that (e.g. cursor control, or other ncurses-like functionality typically used by text-based UIs).

Not sure what exactly you're trying to do, but if you're primarily interested in readline functionality, you might want to take a look at Term::Readline.

You might also just do things the other way round, i.e. make use of vim's Perl interface, and run your commands from there...