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
";
MainLoop;
sub exitProgam {
$mw->messageBox(-message=>"Goodbye");
exit;
}
G:运维系统开发Tk>perl fun.pl
$var is CODE(0x2701b94)
-command 用的是函数的引用