#!/usr/bin/perl use strict; use Tk; use IO::Handle; my $H=IO::Handle->new; open($H,"tail -f -n 1 test.dat |") or die $!; my $main = MainWindow->new; my $t = $main->Text( -wrap=>'none', -height => 2, )->pack(-expand=>1); $main->fileevent(\*$H,'readable',[\&fill,$t]); MainLoop; sub fill { my ($w) = @_; my $text; my $text =<$H>; $w->delete('0.0','end'); $w->insert('end',$text); $w->yview('end'); }