I normally hesitate to post my thoughts in such learned company,
but here goes.
under Win32
perl test.pl QUICK=BROWN\ FOX JUMPED=OVER\ THE\ LAZY DOG
produced an @ARGV of
$ARGV[0] = 'QUICK=BROWN\\';
$ARGV[1] = 'FOX';
$ARGV[2] = 'JUMPED=OVER\\';
$ARGV[3] = 'THE\\';
$ARGV[4] = 'LAZY';
$ARGV[5] = 'DOG';
So to achieve the result required I tried
my $line = join ' ', @ARGV;
$line =~ s/\s(?=\S+=)/\t/g;
@pairs = split(/\t/, $line);
%defaults = map {/([^=]+) # everything up to the = sign into
+ $1
= # the = sign
((\S+\\\s)+ # all words followed by "\ "
\S+) # word after the last "\ "
/x?($1=>$2):()} @pairs;
for ( keys %defaults) {
print $_,"=",$defaults{$_},"\n";
};
which produced
QUICK=BROWN\ FOX
JUMPED=OVER\ THE\ LAZY
Ay_Bee
-_-_-_-_-_-_-_-_-_-_-_-
My memory concerns me
- but I forget why !!!