my $mw = MainWindow->new; my $b1 = $mw->Button(-text => 'Go', -command => sub{&go})->pack(); my $b2 = $mw->Button(-text => 'Exit', -command => sub{exit} )->pack(); my $text = $mw->Scrolled('Text',-scrollbars=>'e')->pack; MainLoop; sub go { my $pid = fork(); if($pid == 0) { open(H, "nmap -A localhost |"); while() { $text->insert('end',$_); } } }