in reply to Tk and using a pipe to read command results

I'm on a fork challenged windoz box and can't run your program, and am also a bit pipe challenged myself. But since nobody replied yet I'll take a shot. My guess is you need to execute $shell_cmd using system and pipe it to CR:

system ("$shell_cmd > &CR");