You should probably be using system instead of exec. Remember that exec actually converts the currently running process into the given command, which might not work as well in a http-process environment.
open(X10, "$command|");
print join('', <X10>);
close(X10);
# Or
print `$command`