It seems to hang on the waitpid() It's not hanging - you're just not seeing the output.
To see the output you'll need to run
BrowserUK's code as
perl -l script.pl. Alternatively, you could change the third line of the code to:
print waitpid( $pid, &WNOHANG ), "\n" while sleep 1;;
Cheers,
Rob