#!/usr/bin/perl use warnings; use strict; $|++; #You could fork off a child and call exec from that child. #Then you could use the PID from fork to call kill. Thus: my $kidpid; if ( !defined( $kidpid = fork() ) ) { #fork returned undef, so failed die "Cannot fork: $!"; } elsif ( $kidpid == 0 ) { exec("xterm -e mc &"); # xterm stays open until mc is exited # or a custom command processor } # this is all executed in the parent #... print "pid $kidpid\n"; sleep 5; # kill -9, $kidpid; print "hit Enter to exit main script\n"; <>; exit;