perlquestion
Anonymous Monk
Dear perl monks: The following code (or something like it) will check the RE in $re for proper syntax. However, -w finds other useful trouble conditions, which it reports to STDERR. I would like to detect these warnings and act on them, and <i>not</i> display them. Can this be done?
<code>
#!/usr/bin/perl -w
$re = '[\w-]';
eval {'' =~ /$re/ }
if($@) {print "error: $@\n"}
</code>
31