I want to have a vi like editor available for user input to a perl script. Someone suggested Term::ReadLine.
That may be what I need but having a problem figuring out how to use it. I wasn't able to convert the examle in Term::ReadLine for my use. SYNOPSIS 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($_), "\n"; warn $@ if $@; print $OUT $res, "\n" unless $@; $term->addhistory($_) if /\S/; } For example: Perldoc Term::ReadLine says (in part): $term = new Term::ReadLine 'name'; or as $term->addhistory('row'); where $term is a return value of Term::ReadLine->Init. "ReadLine" returns the actual package that executes the commands. Among possible values are "Term::ReadLine::Gnu", "Term::ReadLine::Perl", "Term::ReadLine::Stub". "new" returns the handle for subsequent calls to following func- tions. Argument is the name of the application. Optionally can be followed by two arguments for "IN" and "OUT" file- handles. These arguments should be globs. "readline" gets an input line, possibly with actual "readline" sup- port. Trailing newline is removed. Returns "undef" on "EOF". How does one extract a value for these? For example ReadLine? ( I know this isn't correct form, but what is?) use diagnostics; use Term::ReadLine; $var = ReadLine; print $var; Gives nothing usefull I expect `readline' is the part I want but how to access it? Example At a point in a perl script where user input is expected: cat ./readline.pl #!/usr/bin/perl -w use diagnostics; use Term::ReadLine; $stdin = <STDIN>; print "I wrote this line " . $stdin; $ ./readline.pl now how to edit it like in vi? <ENTER> I wrote this line now how to edit it like in vi? How can I use Term::ReadLine to allow user to move around and edit the input line as in vi? Instead of just getting control characters when attempting to move around on the inoput line. Something like what can be done with ksh88 or ksh93. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]