There might be some confusion here.
Perl does not implicitly process either type of quote. The shells on the
respective operating systems process the quotes.
Double quotes
windows - processed by shell
unix - processed by shell
Single quotes
windows - no shell handling
unix - processed by shell.
The behaviour for double quotes is similar for both operating systems. For
single quotes on unix it does fewer substitions than for double quotes -
similar to what perl does in a script.
Behaviour
arg1 = "my stuff"
windows perl
$ARGV[0] eq "my stuff"
unix perl
$ARGV[0] eq "my stuff"
arg1 = 'my stuff'
windows perl (notice the ticks)
$ARGV[0] eq "'my"
$ARGV[1] eq "stuff'"
unix perl
$ARGV[0] eq "my stuff"
The following works on both systems
perl -e "print qq/hi/"
The following works the same on unix
perl -e 'print qq/hi/'
However on windows the shell processes the above command to be the
equivalent of the following
perl -e "'print" "qq/hi/'"
It does this because it does not do anything with single quotes. But it
does do something with spaces - spaces are used as argument deliminators.
And this produces an error because perl sees the single quote as the start
of a string bug there is no terminating single quote in the first argument
so perl produces an error message
Can't find string terminator "'"
anywhere before EOF at -e line 1.
Perl never even looks at the second argumement.
> Behalf Of Philip Newton
>
>
> Andrew Bastien wrote:
> > Whether or not single quotes work depends on the command, as
> > it's the command that has to parse the argument list.
>
> However, at least on NT (cmd.exe) double quotes appear to be interpreted
> either by the shell or (possibly) by Perl -- at least, if I pass "foo bar"
> as a command line argument to a Perl script, it counts as one argument,
> q[foo bar], while 'foo bar' is two arguments, q['foo] and q[bar'].
>
> Moreover, perl -e "insert script here" runs the script, while perl -e
> 'script' does one of two things -- if script contains spaces, you get the
> error message "Can't find string terminator "'" anywhere before EOF at -e
> line 1.", and if it doesn't, nothing happens (presumably, the script is
> interpreted literally as 'script', and executing that just
> results in a true
> value -- like a script line consisting only of
>
> 'script';
>
> ). So, basically, double quotes work to enclose an -e string, while single
> quotes don't.
>
> Cheers,
> Philip
>
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]