in reply to How to add input history
You can use Term::ReadLine module or see 'rlwrap' http://utopia.knoware.nl/~hlub/uck/rlwrap/#rlwrap if you use GNU/Linux.