Ok,   Sorry guys I am trying to get my head around this...

$pair=~m/([^=]+)=(.*)/)

The "m" means treat string as multiple lines

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

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

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

I guess my question is am I right?

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

Thanks in advance...
Scott  



 -----Original Message-----
From:   Felix Geerinckx [mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, May 09, 2002 12:38 PM
To:     [EMAIL PROTECTED]
Subject:        Re: Pattern Matching...

on Thu, 09 May 2002 17:33:21 GMT, Scott Batchelor wrote:

> $pair=~m/([^=]+)=(.*)/)
> 
> This basically says start at the beginning of the string and match
> any "=" all the way to the end of the string...right?

Wrong. 
This says:
Match anything (of at least one character) up to but not including '=' and 
put it in the special variable $1; then match the '='; then match what's 
left (possibly nothing) and put it in the special variable $2.

-- 
felix

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

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

Reply via email to