I have the following code in my program and would like it if the user could enter a value in the entry box and then re-enter a different value if need be. Is there a way to alter this code to allow for re-entry? Thank you!

#!/usr/bin/perl use warnings; use strict; use Tk; use Cwd; ###################################################################### +##################### # GUI Building ###################################################################### +##################### # make the selections available to the print_input_values sub my %t; my %mat; my %ort; my %mat_lab; # Create Main Window my $mw = new MainWindow; my $lam_num; my $row=1; my $column=1; my $lam_mat_frm = $mw -> Frame(); $lam_mat_frm->grid(-row=>$row, -column=>$column,-columnspan=>6); my $lam_num_lab = $lam_mat_frm -> Label(-text=>"Input the number of pl +ies in the laminate.", -font=>"ansi 10 bold"); $lam_num_lab->grid(-row=>$row, -column=>$column); $column++; my $lam_num_ent = $lam_mat_frm -> Entry(-textvariable=> \$lam_num); $lam_num_ent->grid(-row=>$row, -column=>$column); $column++; my $lam_data_button = $lam_mat_frm->Button(-text=>"Input Laminate Data +", -command=> \&input_lam_data); $lam_data_button->grid(-row=>$row, -column=>$column); MainLoop; sub input_lam_data { $row=4; $column=2; my @lam_mat_t_lab = ( 'Material', 'Thickness', 'Orientation', ); my $n = 1; for my $label (@lam_mat_t_lab) { $mat_lab{$n} = $lam_mat_frm -> Label (-text=> $label, -font=>"ansi 8 bold"); $mat_lab{$n}->grid(-row=>$row, -column=>$column); $column=$column+1; }; my %ply_lab; $n = 1; $row=5; do { $column = 1; $ply_lab{$n} = $lam_mat_frm -> Label (-text=>"Ply $n", -font=>"ansi 8 bold"); $ply_lab{$n}->grid(-row=>$row,-column=>$column); $row = $row+1; $n = $n+1; } until ($n == $lam_num+1); # Create Material Optionmenus my @mats = ("PW","8HS","Tape"); my %mat_optmen; $n = 1; $row=5; $column=2; do { $mat_optmen{$n} = $lam_mat_frm -> Optionmenu(-options => \@mat +s, -variable => \$mat{$n}); $mat_optmen{$n}->grid(-row=>$row,-column=>$column); $row=$row+1; $n = $n + 1; } until ($n == $lam_num+1); # Create Thickness Optionmenus my @ts = ("0.0077","0.0147","0.0054"); my %t_optmen; $n = 1; $row=5; $column=3; do { $t_optmen{$n} = $lam_mat_frm -> Optionmenu(-options => \@ts, -variable => \$t{$n}); $t_optmen{$n}->grid(-row=>$row,-column=>$column); $row=$row+1; $n = $n + 1; } until ($n == $lam_num+1); # Create Orientation Optionmenus my @orts = ("-45","0","45","90"); my %ort_optmen; $n = 1; $row=5; $column=4; do { $ort_optmen{$n} = $lam_mat_frm -> Optionmenu(-options => \@ort +s, -variable => \$ort{$n}); $ort_optmen{$n}->grid(-row=>$row,-column=>$column); $row=$row+1; $n = $n + 1; } until ($n == $lam_num+1); my $print_button = $lam_mat_frm->Button(-text=>"Print BJSFM Input +File", -command=> \&print_input_file); $print_button->grid(-row=>$row,-column=>1); }

In reply to Re-Enter Data in Perl TK by shortyfw06

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.