http://www.perlmonks.org?node_id=1026691

hisycg@gmail.com has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use the example code from Term::Readline: http://perldoc.perl.org/Term/ReadLine.html
use Term::ReadLine; my $term = Term::ReadLine->new('Simple Perl calc'); my $prompt = "Enter your arithmetic expression: "; my $OUT = $term->OUT || \*STDOUT; while ( defined ($_ = $term->readline($prompt)) ) { my $res = eval($_); warn $@ if $@; print $OUT $res, "\n" unless $@; $term->addhistory($_) if /\S/; }
It works fine on local machine, but if I put the script on a remote server, then I log in the the server with ssh and execute the script, it does not recognize my up arrow anymore, it only show "^[[A" when I press up arrow. Could anyone give a hint how to fix/debug this? I'm using ubuntu 12.04.