I'm trying to find out whether I have valid input data and wanted to 
use warnings for this purpose - by adding zero to get a number and 
trapping the "argument is not numeric in addition" warning.

Reading through perllexwarn suggests that I should be able to "use 
warnings FATAL => qw(numeric);" for this. Yet the following code 
doesn't do what I expect:

    use warnings FATAL => qw(numeric);
    eval {
      my $price = $content + 0;
      print "<bar>\n";
      $totalPrice += $price;
    };
    if($@) {
      # report an error and "die" with a custom message
    }

In particular, neither is $@ set after this, nor does execution 
terminate completely (in particular, "<bar>" is printed even though the 
warning is printed to STDERR.

This is with ActivePerl 623 (based on 5.6.0).

Any ideas? (Or should I use the regex version or the one based on 
strtod in `perldoc -q determine`?)

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>


Reply via email to