#!/usr/bin/perl use Tk; use strict; my $mw =MainWindow->new(); # Main Window my $frame = $mw->Frame() -> pack(); #New Frame my $lbl = $frame->Label(-text => "some text")->pack(); my $but = $mw -> Button(-text=>"Destroy frame", -command =>\&destroy_frame) -> pack(); MainLoop; #This function will destroy the frame when the button is pushed sub destroy_frame { $frame->destroy(); # destroy method called here }