develooper Front page | perl.beginners | Postings from December 2002

Editing text on the CLI

Pete Emerson
December 4, 2002 05:48
Editing text on the CLI
Message ID:
Suppose I have the following program:

0 #!/usr/bin/perl -w
1 use strict;
2 my $var='Edit this';
3 print "Edit \$var here --> ";
4 print $var;
5 $var=<STDIN>; chomp $var;
6 print "\$var has a new value: $var\n";

Can I insert a line in between line 3 and 4 which will make line for
editable? i.e. right now, line 4 prints out "Edit this", but I can't use
the cursor to delete or modify "Edit this". Is there a way to toggle
this behavior on and off?

Pete Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About