in reply to Parsing Windows CommandLine from Perl

Perl uses the \ backslash character for escaping. Why not use it?

#!/usr/bin/perl use warnings; use strict; for my $arg (@ARGV) { print "$arg\n" }

arg.pl "abc \" xyz"

abc " xyz

Replies are listed 'Best First'.
Re^2: Parsing Windows CommandLine from Perl
by davies (Monsignor) on Apr 18, 2015 at 10:38 UTC

    Because the data may be piped in from something that generates what it knows Windows wants without knowing about Perl.

    Because the intended users might be non-programmers who have only just got to grips with the command line and the rules for doubling quotes, the latter perhaps from recording Excel macros.

    Because the test was written by a third party & that's what the coding shop is being paid to do.

    I'm sure that I could think of lots more examples given time, but what does it matter? It's the question we've been asked. "Just solve a different problem" isn't an answer I've often found helpful. I think it's unlikely to be an XY problem given the OP's history here.

    Regards,

    John Davies