#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; my $t = $mw->Text->pack; my $b = $mw->Button( -text => 'Press Me', -command => \&foo, )->pack; $mw->bind('', [$b => 'invoke']); MainLoop; sub foo { $t->insert('end', "Thank you\n"); $t->see('end'); }