Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1222251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found