use warnings; use strict; use Tk; my $mw = tkinit; my $t = $mw->Text->pack; $mw->Button(-text => 'sel', -command => sub{$t->tagAdd('sel','1.5','2.5')} )->pack; MainLoop;