Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Comparison based on type of value held by variables

by ioannis (Abbot)
on Oct 18, 2005 at 14:52 UTC ( #501001=note: print w/replies, xml ) Need Help??


in reply to Comparison based on type of value held by variables

Instead of regexp recipes, you can always perform the addition and catch the exception. The FATAL keyword bellow will elevate the warning to an exception - check $0 to find if one was raised. (Normally, statements like $var = '3a' + 3 are not fatal.)
my $var = '-.3'; use warnings FATA=> 'numeric'; my $a = eval '$var + 3'; print 'Not a number' if $@;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://501001]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-11-28 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?