there is no way to go up and make the change

Not necessarily...

use warnings; use strict; use IO::Prompter; use Email::Valid; my @fields = ( { name=>'name', desc=>'Name', prompter => { -must => { 'be at least three characters' => qr{\A\w{3,}} } } }, { name=>'mail', desc=>'EMail', prompter => { -must => { 'be a valid email address' => sub { Email::Valid->address(shift) } } } }, { name=>'date', desc=>'Date', prompter => { -must => { 'be in the format DD.MM.YYYY' => qr{\A\d\d?\.\d\d?\.\d\d\d\d\z} } } }, { name=>'pass', desc=>'Password', prompter => { -echo => '*' } }, ); my %data; INPUT: { for my $f (@fields) { my $default = ''; if ( defined $f->{prompter}{-default} ) { if ( defined $f->{prompter}{-echo} ) { $default = " [" . ( $f->{prompter}{-echo} x length($f->{prompter}{-default}) ) . "]"; } else { $default = " [" . $f->{prompter}{-default} . "]"; } } my $rv = prompt( $f->{desc} . $default . ':', %{ $f->{prompter} } ); $data{ $f->{name} } = "$rv"; $f->{prompter}{-default} = "$rv"; } prompt("Is this correct?", -Y1) or redo INPUT; } use Data::Dump; dd \%data;

Although if you really want it to be like a web form, LanX's suggestion is probably better for that.


In reply to Re: Create an html like form on text tty by haukex
in thread Create an html like form on text tty by wodel.youchi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.