Windows never ceases to astonish me.
You think that's astonishing? Brace yourself.

The Windows CLI wants redirection operator characters (e.g.,  > < |) in a double-quoted string to be escaped with a  ^ (hat) character if they are preceded by an odd number of backslash-escaped double-quote characters in the string! (Don't even ask what happens if the backslash escapes are themselves backslash-escaped.)

Consider (this just illustrates redirection-character escaping; the scalar/list context problem with the regex is not addressed):

C:\@Work\Perl\junque>dir Volume in drive C has no label. Volume Serial Number is EC11-ED1D Directory of C:\@Work\Perl\junque 07/07/2009 11:42 AM <DIR> . 07/07/2009 11:42 AM <DIR> .. 07/07/2009 11:41 AM <DIR> 16 07/07/2009 11:41 AM <DIR> 17 foo bar 07/07/2009 11:42 AM <DIR> 18- baz quux 0 File(s) 0 bytes 5 Dir(s) 10,227,699,712 bytes free C:\@Work\Perl\junque>perl -e "for (<*>) { my ($id) = /(\d+)$/ || /^(\d+)/; print qq{$_ => \"id=^>$id\" => x \n}; } " 16 => "id=>1" => x 17 foo bar => "id=>17" => x 18- baz quux => "id=>18" => x C:\@Work\Perl\junque>perl -e "for (<*>) { my ($id) = /(\d+)$/ || /^(\d+)/; print qq{$_ => \"id=>$id\" => x \n}; } " The system cannot find the path specified. C:\@Work\Perl\junque>perl -e "print qq{ (\") \n}; for (^<*^>) { my ($id) = /(\d+)$/ ^|^| /^^(\d+)/; print qq{$_ =^> \"id=>$id\" =^> x \n}; } " (") 16 => "id=>1" => x 17 foo bar => "id=>17" => x 18- baz quux => "id=>18" => x x => "id=>" => x
Enjoy!

In reply to Re^3: Win32 File Creation Weirdness, ActivePerl 5.8.8 by AnomalousMonk
in thread Win32 File Creation Weirdness, ActivePerl 5.8.8 by missingthepoint

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.