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 "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;
> }

The substitution is unnecessary:

if( m|\(.+\s*=\s*(.+)\)| ) { print "$1\n" }

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
jogger, n.:
        An odd sort of person with a thing for pain.

Reply via email to