in reply to Edit STDIN

I think you need some terminal-aware modules like Term::Readline.

Alberto Simões