in reply to Re: ARGV issue.
in thread ARGV issue.

Hi BrowserUk I thought so too at first but that is not the issue. I tried it and my first argument became "This and the last one was test"

Replies are listed 'Best First'.
Re^3: ARGV issue.
by BrowserUk (Patriarch) on Jan 19, 2005 at 02:43 UTC

    The point is, that between where you specify the command string and where Perl is receiving it, something is splitting the command on whitespace--and it's not Perl!

    Quick look at the Java docs shows that exec( String command ) uses StringTokenizer to do the splitting. As far as my quick look went it doesn't have a mechanism for escaping spaces, and from your test, it passes escape-quoted strings with the quotes intact. :(

    However, just below the form of exec that you are using, the docs describe another form: exec( String[] cmdarray ), which without trying to interpret the (Java) docs, sounds suspiciosly like Perl's list forms of exec and system whereby you pre-tokenize the arguments into the array, and they get passed uninterpreted.

    I suggest you pursue that course.

    (I don't like Java, but their documentation is both thorough and easy to use! Perl(6) could learn a thing or two there)


    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.