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/()//
($field,$value) = split /=/, $_
Good luck
At 01:50 PM 5/9/01 -0400, [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 "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 (<TRY>) {
> (my $b=$_) =~ s/^(\() (\w+)/$2/;
> print $b;
>}
>
>
>Thank you for humiliating me with this simple question.
>
>Olivier
>"The one who still has a long way to go with Perl"
Peter Cline
Inet Developer
New York Times Digital