>perl -wMstrict -le "use Tk; ;; my $text; ;; my $mw = MainWindow->new; ;; $mw->Label(-text => 'Enter text: ')->pack(); $mw->Entry(-textvariable => \$text)->pack(); $mw->Button(-text => 'Submit', -command => sub { $mw->destroy } )->pack(); ;; print qq{before MainLoop: enter text: }; my $pre_ml = ; chomp $pre_ml; ;; MainLoop; ;; seek STDIN, 0, 2; print qq{after MainLoop: enter more text: }; my $post_ml = ; chomp $post_ml; ;; print qq{before MainLoop: '$pre_ml'}; print qq{in MainLoop: '$text'}; print qq{after MainLoop: '$post_ml'}; " before MainLoop: enter text: Before after MainLoop: enter more text: After all before MainLoop: 'Before' in MainLoop: 'hi there' after MainLoop: 'After all'