in reply to Killing a child process

The corrected code snippet, with the usual thanks to all commenters.

#!/usr/bin/perl use strict; use diagnostics; use warnings; my $pid = fork || exec 'play', '/home/ra/Desktop/trek2.mp3'; print "My PID is *$pid*\n"; sleep 5; kill 'KILL', $pid;

Replies are listed 'Best First'.
Re^2: Killing a child process
by ikegami (Patriarch) on Oct 03, 2017 at 15:37 UTC

    The approach recommended above is actually the less violent

    kill INT => $pid;