use IO::Socket; use Tk; my $mw = new MainWindow(); my $b = $mw->Button(-text=>'GO', -command=>\&conn)->pack(); my $t = $mw->Text()->pack(); #$|++; #tie *OUT, 'Tk::Text', $t; $t->focus(); MainLoop; sub conn{ tie *STDOUT, 'Tk::Text',$t; $|++; $sock = new IO::Socket::INET(PeerAddr => 'myhost', PeerPort => '800', Proto => 'tcp'); die unless $sock; while (defined($buff = <$sock>)){ print $buff; } }