my $EMAIL; $w{2}->add(undef, 'Buttonbox', -y => -7, -buttons => [ { -label => " [EMAIL] ", -value => 1, -onpress => sub { my $cui=shift()->root; $EMAIL = $cui->question("PLEASE ENTER EMAIL:"); if ($EMAIL) { $w{2}->add( undef, 'Label', -y => -10, -text => "The email you entered is $EMAIL\n"); } else { $cui->dialog("Question cancelled."); } }, }, ], );