#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new(); $mw->title('Hello World'); my $btn1 = $mw->Button( -text=>'print', -command => sub { print "hello world\n" }, -width=>10, -height=>3); my $btn2 = $mw->Button( -text=>'exit', -command=>sub {exit}, -width=>20, -height=>3); $btn1->pack(); $btn2->pack(); MainLoop;