in reply to Re: A problem with variables inside a system() call
in thread A problem with variables inside a system() call

Re-implementing with open(CMD,"| $command"); might be closer to what you want.