in reply to what is *undef* ?
<JOKE>"*undef*" is a more powerful version of the spell "undef"</JOKE>
more seriously, undef is a builtin function that removes the definition from a variable, and returns a special value also known, perhaps unfortunately, as undef. as a value, it represents something which hasn't been defined. since things which aren't defined are hard to add or print, perl has to assume something about what to do in those situations. what it does is pretend zero (for addition or other number-based things) or an empty string (for printing or other string contexts). you'll note that adding zero and printing empty strings are pretty safe, sane things to do.
admittedly, multiplying by zero can be bad, as can regex-matching empty strings, but hey. you shouldn't use undefined values in those situations anyway.
.
|
|---|