sub close { open (TEMP, ">compare"); print TEMP $t->get("1.0", "end"); close(TEMP); print "\$filename equals ",$filename,"\n"; if (compare($filename,"compare") == 0) { print "They are the same\n"; exit; }elsif (compare($filename,"compare") == -1) { $t->insert("end", "There was an error while comparing!\n"); }else{ print "They are different\n"; my $sw = MainWindow->new(-title=>"Content Has Changed"); my $frame = $sw->Frame->pack(-side => 'top', -fill => 'x'); $frame->Label(-text => "The file has changed since last save. 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'); } }