> Thank you, John. This code does exactly what I want. Problem 
> is, I only understand about 30% of what's going on. I can 
> figure out the use of the hash, some of the pattern matching 
> & $1/$2. But can someone elaborate on:
> 
> @keys{ qw/P ST U SL D/ } = \( $Proc, $Start, $Url, $Sleep, $Drive );

This is a shortcut for defining the values of a hash -- it creates
$keys{P} == $Proc, $keys{ST} == $Start, etc.

> /(\S+)=(.+?)(?=\s+\S+=|\z)/g
    ^^^   ^^^ ^^^   ^^^^
     1     2   3      4

1) match one or more non-whitespace characters, followed by a literal
'='

2) match one or more anythings, non-greedy

3) a "zero-width positive look-ahead assertion" (check out perldoc
perlre for more info on this, basically checks that a pattern exists
ahead of what you're currently examining in your regex)

4) this part doesn't make sense to me -- I would think it should be:

(?=\s+=|\z)

instead... I see no cases where there would be any whitespace after your
parameter list is finished, and between, for example, 'ST' and '=',
which is what this sequence allows for...

> ${$keys{uc $1}} = $2;

First of all, $1 and $2 are automatic variables set by backreferences in
the previously evaluated regular expression, the one discussed above.
The 'uc $1' part makes sure that whatever characters are in $1 are
uppercase. It's then read as: take the variable named $keys{uc $1} and
set it to $2. Check out perldoc perlref for more information about this,
especially the section titled: 'Using References'.

After the code is executed, you'd end up with:

$P == 'IcwRcsm D=D:    '
$SL == '20 ST=d:\icw\rcsm\StartSv.bat'

HTH,

 -dave



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to