#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit(); my $frame = $mw->Frame()->pack; for (0..3) { $frame->Button(-text => $_)->pack(-side => 'top'); } $frame->Button(-text => 'clear', -command => [\&clear_frame])->pack(-side => 'top'); MainLoop; sub clear_frame { $_->destroy() for ($frame->children); }