> > > @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.
>
> $keys{P} = \$Proc, $keys{ST} = \$Start, etc.
Okay... Fair enough. Maybe I'm missing something, but why in the world
would you want to make something a hash of references to scalars when a
hash of scalars would work just as well?
> From the OP's post, the data is:
>
> q[P=IcwRcsm D=D: SL=20 ST=d:\icw\rcsm\StartSv.bat Parm1 Parm2
> U=http://uslv...];
>
> /(\S+)=(.+?)(?=\s+\S+=|\z)/g will match:
> (P)=(IcwRcsm)(?= D=)
> (D)=(D:)(?= SL=)
> (SL)=(20)(?= ST=)
> (ST)=(d:\icw\rcsm\StartSv.bat Parm1 Parm2)(?= U=)
> And finally:
> (U)=(http://uslv...)(?=\z)
>
> The (?=\s+\S+=) pattern ensures that the data captured in $2
> has no trailing whitespace.
Alright, thanks for that explanation, I see how that would work for
every case but the last one - what if there was trailing whitespace
after the value for U and before the end of the string? (?=\s+\S+=)
seems like it would pick up the trailing whitespace in that case because
it needs a non-whitespace character to complete the match for the group.
How about:
/(\S+)=(.+?)(?=\s+\S+=|\s+|\z)/g
^^^^
To catch trailing whitespace at the end of the line of data?
> > After the code is executed, you'd end up with:
> >
> > $P == 'IcwRcsm D=D: '
> > $SL == '20 ST=d:\icw\rcsm\StartSv.bat'
>
> Wrong. Run the code I posted and see for yourself.
Yeah, my mistake, I just typed that wrong :)
Cheers,
-dave
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]