Term::Readline::Perl のサンプル
#以下の環境変数の設定は決めうちになってしまうので注意。 $ENV{PERL_READLINE_NOWARN}=1; $ENV{INPUTRC} = "/dev/null"; $ENV{'EDITOR'}="emacs"; use Term::ReadLine; my $term = new Term::ReadLine '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/; } __END__;