in reply to Re: Validating Numbers in CGI Script?
in thread Validating Numbers in CGI Script?

Note, the new 'use warnings' pragma allows for various fine tuning of default and optional warnings -- including promoting any warning category into FATALs for a given lexical scope. So chipmunk's example can also be written as (assuming 5.6+):

for $invalue (qw/ 1 -10 abc /) { eval{ use warnings FATAL=>qw/numeric/; $invalue + 0 }; ### Is Number? if ( $@ ) { print "$invalue is *not* a Number; Details: $@\n"; } else { print "$invalue appears to be a number.\n"; } }

For details see the perllexwarn manpage, and the docs for the warning.pm module.