You can tie STDOUT to a Tk::Text object to have anything printed in perl appear in the text widget. This doesn't handle input, of course, nor does it work with any external programs you might call (for those, see the previous suggestions).
#!/usr/bin/winperl
use warnings;
use strict;
use Tk;
my $mw = MainWindow->new();
my $tx = $mw->Text()->pack();
tie *STDOUT, 'Tk::Text', $tx;
$mw->repeat(1000, \&tick);
MainLoop;
my $count;
sub tick {
++$count;
print "$count\n";
}
bbfu
Black flowers blossom
Fearless on my breath