in reply to Controling and interactive program

Another set of CPAN modules for commandline purposes are Shell::Base and Term::ReadLine