#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my $t = $mw->Text(-width => 80, -height => 25, -wrap => 'none'); $t->pack(-expand => 1); open(CHILD, "./read-stdout-piper 2>&1 |") or die "Can't open: $!"; $mw->fileevent(\*CHILD, 'readable', [\&fill_text_widget,$t]); MainLoop; sub fill_text_widget { my($widget) = @_; $_ = ; if((defined $_) && ($_ > 5)){print chr(07)} $widget->insert('end', $_); $widget->yview('end'); } #### !/usr/bin/perl $|++; for my $i ( 0 .. 10) { print $i, "\n"; sleep 1; } print "sleeping 5\n"; sleep 5; for my $i ( 0 .. 10) { print $i, "\n"; sleep 1; }