#!/usr/bin/perl -w use Tk; $main = MainWindow -> new(); $text_box = $main -> Scrolled ("Text",-spacing2=> 1, -spacing3 => 1, -scrollbars => "e", -height => 20, -background => "white", -relief => "ridge")->pack(); $start = $main->Button()->pack(); $start-> configure (-text => "Start", -command => [\&count]); MainLoop(); sub count { open(README, "test3.pl |") or die "Can't run program: $!\n"; while() { $text_box -> insert ("end", $_); } close(README); } #### #!/usr/bin/perl -w print “Write something: \n”; while (<>) { print; if ($_ =~ /aaa/){ exit; } }