http://www.perlmonks.org?node_id=940737


in reply to system commands and returns

It doesn't "return" to the UNIX command prompt. I does exactly what you ask it to do: start up a *new* shell, as the user passed in as $_[0]. Typing exit causes this new shell to exit, which causes the system to terminate, which causes the next command to run.

If you want to run commands as the other user, pass them as an argument to su.