Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Comparison based on type of value held by variables

by ioannis (Abbot)
on Oct 18, 2005 at 14:52 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found