# simplest way, but ignores error handing my $pid; if($pid = fork() == 0) { exec("other_tk_script"); } #### #!/usr/bin/perl my $kidpid; if ( !defined( $kidpid = fork() ) ) { #fork returned undef, so failed die "Cannot fork: $!"; } elsif ( $kidpid == 0 ) { # fork returned 0, so this branch is child exec("xterm -e top"); # if exec fails, fall through to the next statement die "can't exec : $!"; } else { # fork returned 0 nor undef # so this branch is parent sleep(5); my $result = kill "TERM", $kidpid; print "Killed child process $kidpid (result $result)\n"; sleep(5); }