in reply to get same return that system gives and get pid

Hi Raiden690,

Could you try and paste your code without what I'm guessing is your editor's whitespace markers? (See How do I change/delete my post?)

i would like to get the exact same behaviour that i get with $ret = system( "some command"); but in addition i want to get the pid

When system returns, the external command would normally have finished, so what good will the PID do you? (Windows has the system(1, @args) variant, but I'm guessing you're not on Windows.) Could you explain the bigger picture of what you're trying to accomplish?

In case you're writing some kind of process/daemon that's supposed to go into the background and keep running (and manage a PID file), there are several modules to help you. For example, I've used Daemon::Control a lot recently, although that comes with a lot of extra functions for writing an LSB compatible daemon. There are plenty of alternatives, see for example the recent thread process run in background.

Hope this helps,
-- Hauke D