sub runprogs { # run the main script my $pipe = IO::Pipe->new(); $pipe->reader("$original_script 2>&1"); # create display window my $top = $mw-> Toplevel(); my $label = $top -> Label(-text=>"STDOUT from script",-relief=>"groove")->pack(); my $ro = $top->Scrolled('ROText', -width => 60, -height=>20, -scrollbars=>"e")->pack(); # continuously display output while (<$pipe>) { $ro->insert("end", "$_"); $ro->update(); sleep 1; } # add close button my $close = $top -> Button(-text=>"Close window", -command=>sub { destroy $top; })->pack(); }