in reply to Re: Exploiting Perls idea of what is a number
in thread Exploiting Perls idea of what is a number

Under the influence of use warnings FATAL => qw(numeric);

Replies are listed 'Best First'.
Re^3: Exploiting Perls idea of what is a number
by rovf (Priest) on Jul 08, 2008 at 14:40 UTC
    Under the influence of use warnings FATAL => qw(numeric);

    Actually, just writing use warnings; is sufficient. Example:

    use strict; use warnings; my $value="abc"; my $t=eval { 0+$value }; print "$@\n";
    prints Argument "abc" isn't numeric in addition (+) at U:\develsv\ARTS\playground\eval_test1.pl line 4.

    -- 
    Ronald Fischer <ynnor@mm.st>

      It does print that, but not because $@ is set. Here's a slight modification:

      use strict; use warnings; my $value="abc"; my $t=eval { 0+$value }; print "OMG: $@\n"; __END__ Argument "abc" isn't numeric in addition (+) ... OMG:
        It does print that, but not because $@ is set. Here's a slight modification:

        Now I can see it! Of course it is printed because it is a *warning*, not an exception. Now the explanations of moritz and ikegami finally become clear! Strange - I should have seen this immediately by myself :-(

        Thanks a lot for the clarification.

        -- 
        Ronald Fischer <ynnor@mm.st>