Note that the OP asked about system, which maps conveniently to C's system function (although the perl one may have more magic, I don't remember what it is offhand - looking for shell metacharacters, auto-splitting, etc., I believe). Not about exec, which maps to the exec* functions in C, which does something very, very different. So different, in fact, that bringing it up without extra qualifiers is tantamount to intentionally misleading the poor OP.
In fact, I would even go as far as to say that the differences between system and exec are greater than their similarities, and that they're merely tangentially related. cf., for vs foreach or for/foreach vs map in void context (but some of us don't do that). Very similar (identical!) semantics for these, but system and exec are so completely different...
| [reply] |
On some systems, system would be implemented using fork, exec* and waitpid. exec* alone would not be equivalent, and it wouldn't be as portable. (Windows can't fork and I think it can't exec.)
| [reply] [d/l] [select] |