#!/usr/bin/perl -w use strict; use Tk; my $mw = MainWindow->new; my $main_frame = $mw->Frame()->pack(-side=>'top',-fill=>'x'); my $go_button = $main_frame->Button(-text=>'Go Button', -command => \&do_command)->pack(); MainLoop; sub do_command { # create and display text widget my $tw = $main_frame->Text()->pack(); open (COPY_PROJ, '-|', 'perl testing123.pl') or die "unable to start $!"; my $first_line = "Copying project...please wait"; $tw->insert( 'end', $first_line ); my $copy_proj_line; while (defined ($copy_proj_line =) ) { $tw->insert( 'end', $copy_proj_line ); $tw->update(); ### this is the key to see values as they come } } __END__ file: testing123.pl: #!/usr/bin/perl -w use strict; $|=1; #no buffering on stdout for (1..10) { print "line number $_\n"; sleep 1 if (rand() > 0.5); }