I've looked at the Term::Readline::* modules, but none of them seem to do this part of the task.
They do — at least on *nix (preferably install Term::ReadLine::Gnu, which has quite a few more features)
#!/usr/bin/perl use Term::ReadLine; my $term = new Term::ReadLine 'Demo'; my $prompt = 'Perl> '; while ( (my $cmd = $term->readline($prompt)) ne 'quit') { print "cmd: '$cmd'\n"; }
You can supply a second argument to readline() in case you want to suggest some default input (which can be edited).
In reply to Re: Simulating Command Line History in Perl
by almut
in thread Simulating Command Line History in Perl
by Only1KW
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |