# supposing the program output is all stored in $text: $text =~ s/.*\r//g; #### # you need to know which line number you're at in the Tk::Text buffer # -- let's suppose that's in a variable called "$line_number" @updates = split( /\r/, $latest_output ); for my $string ( @updates ) { $tktext_widget->SetCursor( "$line_number.0" ); # go to start of that line; $tktext_widget->deleteToEndofLine; $tktext_widget->Insert( $string ); $line_number += ( $string =~ tr/\n// ); }