#!/usr/bin/perl use Tk; use Tk::ExecuteCommand; my $mw = MainWindow->new; my $param1 = "word1" ; my $param2 = "word2" ; #my $cmd = `&test($param1, $param2)` ;#Subroutine to be called by the Tk::ExecuteCommand button click my $cmd = sub { my $commandline= "/nfs/work/testing123.pl -text text"; system($commandline) == 0 or warn "Couldn't launch [$commandline]: $!/$?"; #system ("/nfs/work/testing123.pl -text text" &") ; }; $ec = $mw->ExecuteCommand( -command => '', -entryWidth => 50, -height => 10, -label => '', -text => 'Execute', )->pack; $ec->configure(-command => $cmd); $ec->update; MainLoop; sub test {#Subroutine that create a text file to be used in later external Perl script. my ($param1, $param2) = @_ ; my $param1_val = $param1->get ; my $param2_val = $param2->get ; open (TEXT, ">text") ; print TEXT "Field1: $param1\n" ; print TEXT "Field2: $param2\n" ; close TEXT ; open (PROJ, '-|', 'perl /nfs/work/testing123.pl -text text') or die "unable to start $!"; my $first_line = "Start program...please wait"; $ec->insert( 'end', $first_line ); my $proj_line; while (defined ($proj_line =) ){ $ec->insert( 'end', $proj_line ); $ec->update(); } } ---end-----