#!/usr/bin/perl use strict; use warnings; use Tk; my $main = tkinit; $main->Label(-text => 'Hallo')->pack(); $main->Button(-text => 'change', -command => \&foo)->pack(); MainLoop(); sub foo { $main->destroy(); $main = tkinit; $main->Label(-text => 'blubb')->pack(); }