On Thu, May 09, 2002 at 01:54:56PM -0500, Batchelor, Scott wrote:
> $pair=~m/([^=]+)=(.*)/)
> 
> The "m" means treat string as multiple lines

The "m" means "match".  "m" only means treat the string as multiple lines if
it's on the end, i.e. /.../m.  The leading "m" here is basically useless,
but some people like it for clarity.

 
> Then we are grouping with a parenthesis and the "^=" is saying matching
> anything up to the "=" 

The [^=] says "match a characters that is not =".  It must be taken as a
unit, not just as "^=".

 
> The "+" is a quantifier saying that must match 1 or more times...

Correct.

 
> Then the the rest is saying match anything after the "="

The rest says "match =, then match anything".


> I guess my question is am I right?

Approximately.  :)


> And I still am not sure where it is saying to assign the first match to
> variable $1 and then the rest to variable $2

The parentheses "capture" what they match and stored them in numbered
variables.  For example:  "bar" =~ /(.)(.)/ matches, and stores "b" in $1,
and "a" in $2.


So does that clear it up any?  As mud?  As glass?  Something in between?


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to