Hi! On Tue, 16 May 2017 20:11:52 +0900 Masayoshi Fujimoto <m.fujim...@yandex.ru> wrote:
> Hi. > > I would like to get $celebrity. > > How should I do? > I have modified your code based on https://metacpan.org/pod/distribution/Tk/pod/Entry.pod to get what seems to be the desired result: « ««««««««««««««««« #!/usr/local/bin/perl use strict; use warnings; use autodie; use v5.10; use Tk; my $top = MainWindow->new(); my $f1 = $top->Frame()->pack(); my $f2 = $top->Frame()->pack(); $f1->Label(-text => "Celebrity:")->pack(-side => "left"); my $celebrity = $f1->Entry(); $celebrity->pack(-side => "left"); my $name = "Ayumi Kinoshita"; $f2->Button(-text => "OK",-command => [ \&onButton, $celebrity,$name])->pack(-side => "left"); $f2->Button(-text => "Cancel",-command => sub {exit;})->pack(); MainLoop(); sub onButton { my ($celebrity,$name) = @_; say $celebrity; say $name; say "Celebrity string = <", $celebrity->get(), ">"; } »»»»»»»»»»»»»»»»» One note is http://perl-begin.org/tutorials/bad-elements/#prototypes , otherwise your code seems pretty solid. Regards, Shlomi -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/