John W. Krahn wrote:
Adam W wrote:

Here is an example of one of my regexps that produces this warning:
$text =~ s!(.*?)(\()(.*?)(\))!<a\ href=\"\3\" alt=\"\3\">\1<\/a>!g;


BTW, why capture $2 and $4 if you are not using them and why is everything
backslashed?

Since I'm relatively new to the language, most of my regexps are more explicit than is necessary. As for the backslashing, I was under the impression that spaces needed to be backslashed, but now I know that it is not necessary in this context.

$text =~ s!(.*?)\((.*?)\)!<a href="$2" alt="$2">$1</a>!g;

Thanks for the help and the more streamlined regexp.

Adam


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to