The original of the code had a check for Windows and for the version of the ActiveState Perl that first stopped cleaning up for MS. I had put it in a module and it looked like this.

@main::ARGV = map { /[\*\?]/ ? (glob $_) : ($_) } @main::ARGV if $^O =~ /Win/ && $] > 5.00307;

Over time, this was reduced to the code I originally posted. (Which has now been reduced again.) The funny part is that all of the coditional logic was meant to make it easier to use as a module, so that you did not need to remember the code for the one-liner.

Now, the current version is so small that it's easier to type it in when you need it than keep up with the module and always include it. (Since I usually use it in quicky scripts.) In production code, my command line processing is usually more complete than this.

My original reason for posting the code was to help people who have been bitten by this under Windows. It was one little tool that I have used in the past to help people that had to work under MS Windows and would benefit from Perl.

Thanks to everyone for helping me simplify this code even further.

G. Wade


In reply to Re: Re^4: Fix wildcard arguments under MSWin by gwadej
in thread Fix wildcard arguments under MSWin by Anonymous Monk

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.