Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: use warnings is complaining

by LanX (Sage)
on Aug 15, 2018 at 13:42 UTC ( #1220372=note: print w/replies, xml ) Need Help??


in reply to use warnings is complaining

Your data has empty fields, I suppose they are meant to signify zero. So add this after unpacking.
$inc += 0; $exp += 0;
Another interpretation is your data is corrupted.

That's why you get this warning, because Perl can't know what your real intentions are.

Please note how accurate the warning is, it gives you the data line and the code line...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Update

) I just realized that since you are using unpack you get an empty string not undef (like a regex would).

Hence adding 0 will continue giving you a warning.

So better use the $inc ||= 0 approach here, like AnoMonk suggested

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-01-18 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (52 votes). Check out past polls.

    Notices?