in reply to passing argv by reference

Just because @argv is passed by reference, it doesn't always mean that @argv will be modified for you to read the changes. @argv is probably passed by reference simply to prevent the copying of a potentially long list of values or perhaps to make the API for that function easier to change/extend or even to make it possible to detect certain usage mistakes (or perhaps due to all of the above).

In the Unix 'spawn' interface (see exec and/or "man exec"; 'spawn' also involves fork but that part doesn't affect 'argv') argv is clearly copied to the program being invoked and not copied back.

                - tye
  • Comment on Re: passing argv by reference (copy vs. output)