use strict; use warnings; use utf8; use Tk; ${^WIDE_SYSTEM_CALLS}= 1; my $MW = new MainWindow; my $text= $MW->Scrolled(qw/Text -relief sunken -borderwidth 2 -wrap none -height 30 -scrollbars e/) ->pack(qw/-expand yes -fill both/); my $frame= $MW->Frame()->pack(); $frame->Button( -text => 'Run', -command => \&do_run ) ->pack (-side => 'left'); $frame->Button( -text => 'Save' ) -> pack (-side =>'left'); $text->insert ('0.0', "use v5.6.1;\nuse strict;\nuse warnings;\n\n"); MainLoop; ################3 sub do_run { my $s= $text->get('1.0','end'); open OUTFILE, "> quick_run.perl" or die "Cannot save file."; print OUTFILE $s; close OUTFILE; system "perl quick_run.perl"; }