use Unix::PID; my $ps = new Unix::PID -> new(); # wait for completion of GUI's subprocess $ps -> wait_for_pidsof("name of program spawned by GUI"); # kill the GUI process $ps -> kill( $ps -> get_pidof("name of GUI program") );