Ok thanks wags...that explains it.

Now don't flame me hehe but...

$value =~ s/\+/ /g;  is saying substitute any "+" with a space...right?


Again thanks everyone for your help in advance.


Scott
 



 -----Original Message-----
From:   [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, May 09, 2002 1:58 PM
To:     [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject:        RE: Pattern Matching...

        ([^=]+) goes into $1
        (.*)    goes into $2

Unless the parens are escaped(ie, \( ), you count from the left where the
first ( is $1, 2nd is $2 ,etc. They can be nested if necessary.

Wags ;)

-----Original Message-----
From: Batchelor, Scott [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 09, 2002 11:55
To: [EMAIL PROTECTED]
Subject: RE: Pattern Matching...



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]

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

Reply via email to