is this rigth ?
Yes - if, as your code shows, you are using exec. You can use system as well inside the forked process, which allows you to check the return code; you have to exit after that. But you can also do without the fork, since system does an implicit fork, and spawn the process via /bin/sh in the background:
system qq(curl -H "Content-Type: application/json" -X POST -d '$datacu
+rl' http://192.168.125.169/index.php/itsqd/v1/nmessage &); # <--- not
+ice the ampersand
This lets you check - again, via the return code, which should be 0 on success - whether the shell succeeded spawning curl. If so, the shell returns immediately, and the curl process runs in the background. Otherwise the shell exits with a non-zero value, which is returned by system.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'