|Perl Monk, Perl Meditation|
Re: "undef" is not NULL and what to do about itby flexvault (Monsignor)
|on Feb 21, 2013 at 11:14 UTC||Need Help??|
Good Day Ovid,
I'm sure plenty of you see the bug: what if the employee doesn't have a salary? I've already outlined several reasons above for why the salary might be undefined, not all of which mean "this employee has no salary..."
I'm confused by your example, and the code below shows why I'm confused. In memory the value for 'salary' is undefined, but once it written to disk, whenever it is accessed after the initial 'write', the field is defined. So if this is a quirk of the DB you're using, why expect Perl to fix it? Everyone else seems to understand you're problem, but it seems related to the DB you're using and not to a specific Perl problem.
Now if this is to solve a DB related flaw, then I see your point. But I don't understand how 'unknown' is better then 'undef/defined' in Perl scripts. YMMV!
Maybe the title should have SQL in front of "NULL" to clarify the intent of the 'unknown'.
"Well done is better than well said." - Benjamin Franklin