#!/usr/local/bin/perl -w use Tk; use Tk::HList; use Tk::ItemStyle; $|=1; ######################## # Text Window my $mw2 = MainWindow->new; $mw2->title("LogViewer"); my $tex = $mw2->Scrolled("Text", -background => 'grey', -foreground => 'white' )->pack( -fill => 'both', -expand => 1, ); #create text tag $tex->tagConfigure('red', -foreground => 'red' ); Tk::MainLoop; sub DisplayItem { print "Called DisplayItem\n"; $tex->insert("end", "$_[0]", 'red' ); } while( ) { print "While called with: $_\n"; chomp; &DisplayItem( $_ ); } # end while