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


in reply to command recall

There isn't really an easy way you can send the command to a shell for editting (the only way I could think of was using ptys, and that would be overkill for such a little script :-)

However, help is at hand in the form of Term::ReadLine, which can be used to create a line editor similar to that used by shells like bash:

use strict; use Term::ReadLine; my $term = new Term::ReadLine 'readline demo'; my $line = $term->readline(">> "); print "Line was: $line\n";
Although note that the capabilities tend to vary depending on how your version of perl was compiled, as the readline library is not always available.

Andrew.