Hi Sean, On Wed, 8 Feb 2012 18:37:37 +1100 Sean Murphy <mhysnm1...@gmail.com> wrote:
> Hi All. > > This should be a simple task. But for the life of me, I cannot work it out. > I have a chunk of text in an scaler. I want to edit this text. I look at > Term::ReadLine and couldn't see a way of inserting the text into the edit > area. There is addhistory which adds to the history buffer. but this isn't > want I want. > > For example: > > $text = "this is a test"; > $text = function ($text); # permits full editing of line. > print "$text\n"; > > When script is executed. The text in $text is displayed. The cursor and > delete commands work. So the line can be modified. > > so how can this be done? I haven't seen any modules that seem to permit this. > Example code would be great. > > This is for a program I am writing to handle my home budgets. I am extracting > the text from a database using DBI. > After reading https://metacpan.org/module/Term::ReadLine::Gnu I came up with the following program which appears to start with the string "Hello". Hope it helps: #!/usr/bin/perl use strict; use warnings; use Term::ReadLine; my $rl = Term::ReadLine->new; while (my $text = $rl->readline('$', 'Hello')) { print "You've given '$text'\n"; } ================= Regards, Shlomi Fish > Sean -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/ And the top story for today: wives live longer than husbands because they are not married to women. — Colin Mochrie in Who’s Line is it, Anyway? Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/