[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/
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
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;
: > }
: >
:
- 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
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
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
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