Split Problem

2003-03-27 Thread Jimstone77
I'm having a problem splitting a variable and need some help. What I have is some variables with a name, and then information in parens. A couple examples: $data = David (man from uncle); $data = John Doe (The boy down the hall); What I want to do is split $data into two string

Re: Split Problem

2003-03-27 Thread Aim
Hi, Somethig like this should work (untested): my ( $name, $info ) = split /\(/, $data; regards, Aim. [EMAIL PROTECTED] wrote: I'm having a problem splitting a variable and need some help. What I have is some variables with a

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: $data = David (man from uncle); $data = John Doe (The boy down the hall); What I want to do is split $data into two string variables, one holding the $name, and the other holding all the $info that is within the parens. How would

Re: Split Problem

2003-03-27 Thread Stefan Lidman
Janek Schleicher wrote: Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: $data = David (man from uncle); $data = John Doe (The boy down the hall); What I want to do is split $data into two string variables, one holding the $name, and the other holding all the $info that is

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Stefan Lidman wrote at Thu, 27 Mar 2003 13:55:27 +0100: Janek Schleicher wrote: I would use a regexp: my ($name, $info) = $data =~ /(.*?)\w+\((.*)\)/; I guess you ment: my ($name, $info) = $data =~ /(.*?)\s*\((.*)\)/; Yep. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: Janek Schleicher wrote: $data = David (man from uncle); $data = John Doe (The boy down the hall); What I want to do is split $data into two string variables, one holding the $name, and the other holding all the $info that is

Re: Split Problem

2003-03-27 Thread Rob Dixon
Janek Schleicher wrote: Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: I'm afraid your regex is wrong! It does the following: Yep, it was a typo and untested. capture zero or more (as few as possible) of any character !! match one or more 'word' characters followed by an

Re: split problem

2001-08-05 Thread Me
What's the problem with my split? $line = "var=value"; ($var, $value) = split(/\s*[=]\s*/, $line); Looks fine to me. I experienced that $var and $value contained the first letter of the var and the value. Sometimes nothing. Where is the error? Looks to me like it must be in your

Re: split problem

2001-08-05 Thread Michael Kelly
On 8/5/01 9:39 PM, Romek KrisztiƔn wrote: Hello! What's the problem with my split? $line = var=value; ($var, $value) = split(/\s*[=]\s*/, $line); Krisztian I experienced that $var and $value contained the first letter of the var and the value. Sometimes nothing. Where is