in reply to [Win32] Weird behavioural change between 5.38.0 and 5.40.0

In Windows, it's up to each program to parse their command line. It's not up to the shell. So it's up to Perl to parse the command line.[1]

But it's not Perl itself that parses the command line; it hands this off to the underlying C library.

So I suspect a difference in the C library used.

As a solution, you could escape the quote using a backslash (\"). I must admit that """ as an escape for " is very unexpected to me.


  1. Yes, this is bonkers.

Replies are listed 'Best First'.
Re^2: [Win32] Weird behavioural change between 5.38.0 and 5.40.0
by cavac (Prior) on Aug 03, 2024 at 19:14 UTC

    In Windows, it's up to each program to parse their command line. It's not up to the shell. So it's up to Perl to parse the command line.

    Yes, this is bonkers.

    Unfortunately, that's the idiotic price for perfects backwards compatibility. MS-DOS has done it this way, so Windows does it this way, too. And i rather suspect, MS-DOS did it this way, because the command line interpreter for Microsoft Basic (which was the "shell" of many 8 bit computers) did this for the "run" command - just push the rest of the command line on the stack (or just leave it in the input buffer, as it were) and have the newly started program figure it out.

    "8-Bit Show And Tell" on Youtube has you covered there: https://www.youtube.com/watch?v=HC2--B9ZhUA

Re^2: [Win32] Weird behavioural change between 5.38.0 and 5.40.0
by syphilis (Archbishop) on Aug 04, 2024 at 02:15 UTC
    As a solution, you could escape the quote using a backslash (\").

    Thanks - that seems to work fine.

    I must admit that """ as an escape for " is very unexpected to me.


    Me, too.
    In fact, it was so unexpected that I didn't even consider the possibility of that being its purpose.
    Upon reflection, however, I think I've been told about that before ... and then forgotten ....
    I reckon I'll be able to remember it now ... for at least a fortnight.

    UPDATE: For anyone who is wondering, it's the white space between the 2 triplets of double-quotes that's tripping things up on perl-5.40.0:
    C:\>perl -we "printf("""Version:%s\n""", $]);" Version:5.040000 C:\>perl -we "printf("""Version: %s\n""", $]);" Can't find string terminator '"' anywhere before EOF at -e line 1
    Cheers,
    Rob
Re^2: [Win32] Weird behavioural change between 5.38.0 and 5.40.0
by ikegami (Patriarch) on Aug 12, 2024 at 14:42 UTC

    So I suspect a difference in the C library used.

    It's my understanding from the comments here that SP 5.40.0.1 switched from using a compiler that uses MSVCRT to one using to UCRT (such as Visual Studio 2022 and mingw-w64 ports of gcc-13.2.0).

Re^2: [Win32] Weird behavioural change between 5.38.0 and 5.40.0
by ikegami (Patriarch) on Aug 03, 2024 at 17:50 UTC

    Added solution.