use Tk;
# Main Window
my $mw = new MainWindow;
my $label = $mw -> Label(-text=>"Hello World") -> pack();
my $button = $mw -> Button(-text => "Quit",
-command =>\&exitProgam)
-> pack();
$var = \&exitProgam;
print "\$var is $var\n";
MainLoop;
sub exitProgam {
$mw->messageBox(-message=>"Goodbye");
exit;
}



G:\运维系统开发\Tk>perl fun.pl
$var is CODE(0x2701b94)


-command 用的是函数的引用