#!/usr/local/bin/perl -w use Tk; $t=new MainWindow; $l=$t->Text; $l->insert('end',"make this red\n", 'red'); $l->insert('end',"make this blue\n", 'blue'); $l->insert('end',"make this green\n", 'tagForGreen'); $l->pack; $l->tag(configure => 'red', -foreground => 'red'); $l->tag(configure => 'blue', -foreground => 'blue'); $l->tag(configure => 'tagForGreen', -foreground => 'green'); $t->Button(-text => 'exit',-command => sub {exit;})->pack; MainLoop;