Windows is weird.

These are the rules related to commands passed to the shell via cmd /C, which I believe how perl passes the command to the operating system.

M:\>help cmd Starts a new instance of the Windows 2000 command interpreter CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V: +OFF] [[/S] [/C | /K] string] /C Carries out the command specified by string and then terminate +s /K Carries out the command specified by string but remains /S Modifies the treatment of string after /C or /K (see below) /Q Turns echo off ... deleted lines... If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic i +s used to process quote (") characters: 1. If all of the following conditions are met, then quote charact +ers on the command line are preserved: - no /S switch - exactly two quote characters - no special characters between the two quote characters, where special is one of: &<>()@^| - there are one or more whitespace characters between the the two quote characters - the string between the two quote characters is the name of an executable file. 2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preservin +g any text after the last quote character.
I'm not quite sure why your original code worked
print STDERR "my echo.pl"
because it does not work for me. Possibly different flavours of Windows.

Anyways, my echo.pl is not an executable file, it is just that the file extension is associated with an executable.

try.pl

eval {print `my echo.pl`}; eval {print `"my echo.pl"`;}; eval {print `perl "my echo.pl"`}; eval {print `perl "my echo (v1).pl"`};
my echo.pl and my echo (v1).pl:
print "hello sandy\n";
Results "try.pl"
M:\>try.pl Can't open perl script "M:\my": No such file or directory Can't open perl script "M:\my": No such file or directory hello sandy hello sandy
Conclusion: Do not rely on Windows to resolve the file extionsions to determine the 'real' executable, but use the proper name (perl in this case). Quote the filename.

Hope that helps.


In reply to Re: Quotable Quotes by Sandy
in thread Quotable Quotes by b4swine

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.