sub close { chomp(my $data = $t->get("1.0", "end")); open (TEMP, ">compare") || $t->insert("end", "Cannot open \"compare\"\n"); print TEMP $data; close(TEMP); if ($filename ne "") { my $compare = compare($filename, "compare"); if ($compare == 0) { exit; }elsif ($compare == -1) { $status->insert("end", "There was an error while comparing!\n"); }else{ my $sw = MainWindow->new(-title=>"Content Has Changed"); my $frame = $sw->Frame->pack(-side => 'top', -fill => 'x'); $frame->Label(-text => "Would you like to save before exiting?")-> pack(-side => 'left', -anchor => 'w'); $frame->Button(-text => "No", -background => 'navy blue', -foreground => 'white', -command => sub {exit;})-> pack(-side => 'right'); $frame->Button(-text => "Yes", -background => 'navy blue', -foreground => 'white', -command =>\&save_and_exit)-> pack(-side => 'right'); } }else{ my $sw = MainWindow->new(-title=>"Save File?"); my $frame = $sw->Frame->pack(-side => 'top', -fill => 'x'); $frame->Label(-text => "Would you like to save before exiting?")-> pack(-side => 'left', -anchor => 'w'); $frame->Button(-text => "No", -background => 'navy blue', -foreground => 'white', -command => sub {exit;})-> pack(-side => 'right'); $frame->Button(-text => "Yes", -background => 'navy blue', -foreground => 'white', -command =>\&save_and_exit)-> pack(-side => 'right'); } }