Hi.
I would like to get $celebrity.
How should I do?
% perl tk.pl
Tk::Entry=HASH(0x804abddc8)
Ayumi Kinoshita
(tk.pl)
#!/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;
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/