Hello kind monks. I am writing a quick and dirty script to do array command line processing. I want it to be able to accept arguments in the form of:

args.pl FOO=BAR TEST=VISION EVERYTHING=TWO

I'm pleased to say that it works with this script:
my $defaults = {}; %defaults = map {(($_ =~ /([^\=]+)\=([^\s]+)/)?("$1" => "$2"):())} @AR +GV; print join(",", keys %defaults);
This is a build script for the curious. I do NOT want to use a module, because I'm not going to learn why this script isn't working, so I thank you, but please none of those suggestions. This is for theory at this point. Now, I want to add in the functionality to be able to take backslashed spaces off of the command line (as in a directory with spaces in it, or other sort of item, or anything else to make it more extensible). Like:

args.pl QUICK=BROWN\ FOX JUMPED=OVER\ THE\ LAZY DOG

Validly finding QUICK and JUMPED as keys, but ignoring DOG.
However, I can't seem to get it to work with the regular expression. Boiling it down:
$_ =~ /([^\=]+)\=([^\s]+)/
is where this hell lies. The way I'm thinking of it, I see it as: So, substituting this in a couple of ways:
$_ =~ /([^\=]+)\=([[^\s]|[\\\s]]+)/)
That didn't work

Neither did:
$_ =~ /([^\=]+)\=([^[[^\\]\s]]+)/
Same as above except the last is: This has the disadvantage of possibly being outright wrong (matching two characters?), but it's something I gave a shot to. So before I take up the shotgun and going blasting into the night for answers, can someone point me in the right direction? Am I looking for simply getting my negations right, or I am looking for more powerful regular expression gear. Thanks a bunch.

    --jb

In reply to Regular expression double grouping negation headache by JayBonci

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.