bangers has asked for the wisdom of the Perl Monks concerning the following question:
Most of the time the user will leave the value unchanged or make minor spelling or capitalisation changes. To make it easier for them I’d like to push the existing value into the keyboard buffer so that it appears on the line as if they had just typed it. That way they can quickly amend it or just press return and it will come in through STDIN as if they had just typed it. Any help will be gratefully appreciated.my $record = { name => 'joe bloogs', age => 34, hobby => 'chess', }; for my $property ( keys %$record ) { print STDOUT "$property: "; chomp( $response = <STDIN> ); $record->{$property} = $response; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: adding default text to STDIN
by Fletch (Bishop) on Nov 09, 2005 at 16:14 UTC | |
by bangers (Pilgrim) on Nov 09, 2005 at 18:05 UTC | |
|
Re: adding default text to STDIN
by tinita (Parson) on Nov 09, 2005 at 16:31 UTC | |
by bangers (Pilgrim) on Nov 09, 2005 at 18:10 UTC |