in reply to (Windows) verbatim command line arguments inside Perl script

I don't think this question is overly Win specific, when creating a bash script on Linux I'd face the same problem.

Except that (1) bash has sane quoting rules and (2) you don't need to mess with quoting and bash at all because you can use the list form of system() and exec(), and so can pass each argument as intended (see The problem of "the" default shell).

Question: any better solution?

For generating a batch file with tons of insane quoting? Here-documents, with or without interpolation, depending on your needs.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re: (Windows) verbatim command line arguments inside Perl script

Replies are listed 'Best First'.
Re^2: (Windows) verbatim command line arguments inside Perl script
by LanX (Saint) on Apr 16, 2021 at 14:38 UTC
    > Except that (1) bash has sane quoting rules and (2) you don't need to mess with quoting and bash at all

    That's - like expected - a lot of emotion ...

    Bash is much saner but not sane.

    And since I'm biased towards bash - I know it far better - I can't even tell if I'm objective.

    > because you can use the list form of system() and exec(), and so can pass each argument as intended (see The problem of "the" default shell).

    You are missing my point, not sure if you even read the OP ...

    I have to create scripts in the "default shell" with Perl.

    And need the recreate the input 1-to-1.

    And at least my workaround works so far...

    > see The problem of "the" default shell).

    thanks

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery