Tk::Error: Not a CODE reference at C:/Perl/site/lib/Tk.pm line 251. Tk callback for .frame.frame.button3 Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 251 Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 175 (command bound to event) #### use warnings; use strict; use Tk; use Tk::Text ; use POSIX 'strftime'; my $DATE = strftime("Run Failures.pl for %dth %b %Y" , localtime()); my $mw = MainWindow->new; my $filename = "c:\\Temp\\perl.txt"; $mw->geometry("720x500"); $mw->title(" backupadmin "); my $main_frame = $mw->Frame()->pack(-side => 'top', -fill => 'x'); my $left_frame = $main_frame->Frame(-background => "snow2")->pack(-side => 'left', -fill => 'y'); my $right_frame = $main_frame->Scrolled("Text", -scrollbars => 'se',-background => "black",-foreground => "yellow",-height => '44')->pack(-expand => 1, -fill => 'both'); my $failures_button = $left_frame->Button(-text => " $DATE ", -command => \&runscript)->pack; my $Close_button = $left_frame->Button(-text => ' Close ', -command => $mw => 'destroy')->pack; my $Help_button = $left_frame->Button(-text => " Help Guide ", -command => \&load_file)->pack(-side => "bottom"); my $Close_help = $left_frame->Button(-text => ' Close Help ', -command => \&clear_file )->pack(-side => "bottom"); MainLoop; sub runscript { system("daily_failures.pl"); # or if it takes some time to run the script #system("daily_failures.pl &"); # runs in the background } sub load_file { open (FH, "$filename"); while () { $right_frame->insert("end", $_); } close (FH); } sub clear_file { $right_frame->delete('1.0','end'); $right_frame->packForget; }