in reply to perl script like a "shell proxy"

I don't really know how to do it, but at least I know how it's called, a REPL, read-eval-print-loop.

Perhaps searching for that might reveal some ideas. Perhaps the source of Devel::REPL is inspiring as well.