JayBonci has asked for the wisdom of the Perl Monks concerning the following question:
args.pl FOO=BAR TEST=VISION EVERYTHING=TWO
I'm pleased to say that it works with this script: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:my $defaults = {}; %defaults = map {(($_ =~ /([^\=]+)\=([^\s]+)/)?("$1" => "$2"):())} @AR +GV; print join(",", keys %defaults);
args.pl QUICK=BROWN\ FOX JUMPED=OVER\ THE\ LAZY DOG
Validly finding QUICK and JUMPED as keys, but ignoring DOG.is where this hell lies. The way I'm thinking of it, I see it as:$_ =~ /([^\=]+)\=([^\s]+)/
$_ =~ /([^\=]+)\=([[^\s]|[\\\s]]+)/)
Same as above except the last is:$_ =~ /([^\=]+)\=([^[[^\\]\s]]+)/
|
---|