my $tx = $mw->Scrolled("Text", -width => 80, -height => 25, -wrap => 'none', )->pack(-expand => 1, -fill => 'both'); open(CHILD, "ls -laR |") or die "Can't open: $!"; CHILD->autoflush(1); $mw->fileevent('CHILD', 'readable', [\&output, \*CHILD, $mw, $tx]); #### sub output { my ($handle, $widget, $tx) = @_; if (sysread ($handle, $_, 128)) { $tx->insert('end', $_); # Append the data read $tx->yview('end'); } else { $tx->insert('end', "\nALL DONE\n"); $tx->yview('end'); $widget->fileevent($handle, "readable", undef); # cancel binding ###----->>> Add in cancel routine here if you want to exit gracefully return; } $widget->idletasks; }