#! /usr/bin/perl -w use Tk; my $mw = new MainWindow; $mw->geometry("300x300"); $mw->title("Perl Tk Checkbutton"); my $check_frame = $mw->Frame()->pack(-side=>"top"); my $label=$check_frame->Label(-text=>"Enter keywords")->pack(-side=>"top")->pack(); my $entry = $check_frame->Entry()->pack(); #my $chk1 = $check_frame->Checkbutton(-text=>"Alaska",-variable=>"Alaska")->pack(); my $state = "Alaska"; my $chk1 = $check_frame->Checkbutton(-text=>"Alaska",-command=>[\&check_sub,$state])->pack(); my $chk2 = $check_frame->Checkbutton(-text=>"Michigan",-variable=>"Michigan")->pack(); my $button_frame = $mw->Frame()->pack(-side=>"bottom"); my $ok_button = $button_frame->Button(-text=>"Submit",-command=>\&check_sub)->pack(-side=>"left"); MainLoop; sub check_sub{ print $_; my @names = $entry->get(); print @names; exit; }