in reply to re-attaching?

Check if screen is installed on your system. It's a program that lets you talk to multiple programs running on different ptys and switch back and forth between them. It will also allow you to detatch from the session and then reattach later and get back in touch with what you left running. See http://www.gnu.org/software/screen/ for more details.

You could do something similar in perl, but a) you'd be reinventing a wheel that already works fine, and b) it involves some deep UNIX mojo to do correctly.