sub addmanifest { my $perInfo9 = {NAME => '', TOWNS => '', TRAILER => ''}; my $addmn = $mw->Toplevel(); $addmn->group($mw); $addmn->resizable(0,0); # Create the main window $addmn->configure(-title=>'Add Manifest'); $addmn->geometry('285x270+0+0'); my $personInfo9 = $addtmn->Frame()->pack(-side=>'top',-fill=>'x'); my $personLeft9 = $personInfo9->Frame()->pack(-side=>'left',-fill=>'x'); my $personRight9 = $personInfo9->Frame()->pack(-side=>'left',-fill=>'x',-padx=>20,-pady=>20); $personLeft9->Label(-text=>'Manifest Information')->pack(); $personLeft9->Label(-text=>'')->pack(); $personLeft9->Label(-text=>'Manifest Name')->pack(); $personLeft9->Label(-text=>'Manifest Towns')->pack(); $personLeft9->Label(-text=>'Manifest Trailer')->pack(); $personRight9->Label(-text=>'')->pack(); $personRight9->Label(-text=>'')->pack(); $personRight9->Entry(-width=>20,-borderwidth=>2, -relief=>'sunken',-textvariable=>\$perInfo9->{NAME})->pack(); $personRight9->Entry(-width=>20,-borderwidth=>2, -relief=>'sunken',-textvariable=>\$perInfo9->{TOWNS})->pack(); $personRight9->Entry(-width=>20,-borderwidth=>2, -relief=>'sunken',-textvariable=>\$perInfo9->{TRAILER})->pack(); my $saveFrame9 = $addmn->Frame()->pack(-side=>'top',-fill=>'x'); $saveFrame9->Button(-text => 'Add Manifest', -command => sub { open(OUT,">>DATA/manifestdata.txt"); print OUT "" . $perInfo9->{NAME} . ":"; print OUT "" . $perInfo9->{TOWNS} . ":"; print OUT "" . $perInfo9->{TRAILER} . "\n"; close(OUT); sleep 2; $addmn->withdraw; $mm->deiconify; # THIS IS SUB MENU TWO IT HAS TO BE SUBMENU THREE HOW EVER THE BELOW ERROR OCCURS when $mm is used, I have to use $opsm in order for it to work correctly } )->grid(-row, 2, -column, 0, -sticky => 'nesw'); $balloon->attach($saveFrame9, -balloonmsg => "Return To Add Manifest"); } # END __ERROR__ Tk::Error: Can't call method "deiconify" on an undefined value at C:\USER\PERL\PROGRAM\test-gui.pl line 3995. Tk callback for .toplevel3.frame1.button Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 250 Tk::Button::Invoke at C:/Perl/site/lib/Tk/Button.pm line 200 (command bound to event)