1 2 3 4 5
my $wort = "tomas"; print $wort; chomp (my $temp = <>); if ($temp) {$wort = $temp} print "$wort\n";
QuoteIf you are missing full line editing (left/right, delete to the left and right, jump to the beginning and the end etc.), you are probably wrong here, and want to consider Term::ReadLine and friends.
1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/perl use warnings; use strict; use Term::ReadLine; my $wort = "tomas"; my $term = Term::ReadLine->new('example'); $term->ornaments(0); $wort = $term->readline("", $wort); print "$wort\n";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#! /usr/bin/env perl use strict; use warnings; use 5.010.000; use Term::ReadLine; my $term = Term::ReadLine->new("xyz"); say "Using " . $term->ReadLine; my $predefined = "Tomas"; my $answer = $term->readline( "Check that name: ", $predefined ); say "Your answer was: $answer"; __END__ Using Term::ReadLine::Gnu Check that name: Tomas # mit Pfeilen nach links wandern und 'h' einfuegen; <Enter> Your answer was: Thomas