Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Some "combined assignment operators" are exempt from "uninitialized value" warning. Is it documented anywhere?

by Anonymous Monk
on Sep 12, 2018 at 18:50 UTC ( #1222251=note: print w/replies, xml ) Need Help??


in reply to Some "combined assignment operators" are exempt from "uninitialized value" warning. Is it documented anywhere?

When I was new to Perl uninitialized values were the bane of my existence. Many traps are eliminated simply by initializing all variables. It's useful to init strings to '' and numbers to 0 so they can be freely checked and used after declaration without having to worry about init errors. If there's a problem with the program it will display the init values instead of crashing with an error. My preference is always: not to crash.
my $value; # Error if condition fails. my $value = ''; # Empty if condition fails. if (condition) { $value += 'something' } print "The value is $value";
  • Comment on Re: Some "combined assignment operators" are exempt from "uninitialized value" warning. Is it documented anywhere?
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2019-02-19 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (105 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!