> Sent: Wednesday, June 26, 2002 11:30 AM
> Subject: RE: extracting a string from between parens
> >I have this situation:
> > $in = "02 Jul 5.00 (YHZ GA-E)"
> >I want:
> > $out = "YHZGA-E"
> >How do I extract the information between the ()s ?
> >Other than the parens all other characters are likely to change.
> $in =~ /\((.*?)\)/;
> $out = $1;
previous value was. Just use match operator in list context:
($out) = $in =~ /\((.*?)\)/;
Now $out will be undef if there is no match.