RE: Very beginner question

2001-05-09 Thread King, Jason
[EMAIL PROTECTED] writes .. >(name = john) - >if I am trying to just extract "john" for the value $b, why would the >following script not work. I thought it would take bothIt returns the >full (name=john) > >#!user/local/bin/perl -w > >open TRY , "try.txt"; > >while () { > (my $b=$_) =~ s/

Re: Very beginner question

2001-05-09 Thread Brett W. McCoy
On Wed, 9 May 2001 [EMAIL PROTECTED] wrote: > I feel strange putting such a simple question on this list, but then > again, that is why I did not join the experts list. > > Any how, if I have a file called "try.txt" with the following line: > > (name = john) > > if I am trying to just extract "jo

Re: Very beginner question

2001-05-09 Thread Casey West
On Wed, May 09, 2001 at 12:27:26PM -0500, John Joseph Trammell wrote: : On Wed, May 09, 2001 at 01:50:24PM -0400, [EMAIL PROTECTED] wrote: : > #!user/local/bin/perl -w : > : > open TRY , "try.txt"; : > : > while () { : > (my $b=$_) =~ s/^(\() (\w+)/$2/; : > print $b; : > } : > :

Re: Very beginner question

2001-05-09 Thread M.W. Koskamp
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 09, 2001 7:50 PM Subject: Very beginner question > > if I am trying to just extract "john" for the value $b, why would the > following script not work. I thought it would take bothIt returns the

Re: Very beginner question

2001-05-09 Thread John Joseph Trammell
On Wed, May 09, 2001 at 01:50:24PM -0400, [EMAIL PROTECTED] wrote: > #!user/local/bin/perl -w > > open TRY , "try.txt"; > > while () { > (my $b=$_) =~ s/^(\() (\w+)/$2/; > print $b; > } > > Thank you for humiliating me with this simple question. Any time. #!/usr/bin/perl -w use st

Re: Very beginner question

2001-05-09 Thread Peter Cline
I don't quite understand what your regex is intended to do, but if you try tr/()//; s/^.+=//; it should return John as you intend. The tr will remove the parentheses and the substitution will match everything up to the = and substitute it with nothing. alternatively you could do: tr/()// ($f

Re: Very beginner question

2001-05-09 Thread Jeff Pinyan
On May 9, [EMAIL PROTECTED] said: >(name = john) > >if I am trying to just extract "john" for the value $b, why would the >following script not work. I thought it would take bothIt returns the >full (name=john) Let's run your regex through the regex explainer: > (my $b=$_) =~ s/^(\() (\w