Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: use warnings is complaining

by Anonymous Monk
on Aug 15, 2018 at 13:46 UTC ( [id://1220375]=note: print w/replies, xml ) Need Help??


in reply to use warnings is complaining

Check for empty string and substitute a number instead:
$inc ||= 0; $exp ||= 0;
Those expressions transform to $var = $var || 0; and $var is false when it's zero-ish, undef or an empty string. When it's zero, we're not changing anything; we should not get undef in this program; and the empty string the cause of this warning, which we're replacing with 0.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found