> 
> On Wednesday, June 26, 2002, at 08:48  AM, Shishir K. Singh wrote:
> 
> >> $out = $1 if ($in =~ /\((.*?)\)/);
> > Nope..won't work..I take it back!!
> >
> 
> >looks ok to me. except it adds extra strokes to previous answer.
> >what do you think is wrong with it?
> 
> It will work fine as far as the regex is concerned. I think 
> what Todd may want is to check the $out for defined or 
> undefined. This line won't give him the same kind of validation. 
> 
> 
> Perhaps..he should be doing it this way
> 
> $in =~ /\((.*?)\)/;
> $out = (defined($1) ? $1 : "default/undef/whatever??";

>Sorry, still not right. defined($1) is no better than $1 alone after
>a failed match.

>Again, the most straightforward solution is:

>  ($out) = $in =~ /\((.*?)\)/;

You are right ...this will be the the most simple sol..in case nothing needs to be 
done to $out...but in case 
some thing needs to be done on $out which I am assuming to be true, then the value of 
$out needs to be checked again,  which introduces additional lines and variable 
declaration.






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to