On Wed, 2003-01-29 at 14:54, Jonathan Scott Duff wrote:

> Can someone give me a realish world example of when you would want an
> array that can store both undefined values and default values and those
> values are different?

my @send_partner_email is default(1);
while $websignups.getline {
        ($id) = /UserID: (\d+)/;
        if /Source: External DB With No Privacy Policy/ {
                @send_partner_email[$id] = undef; # No answer given
        } elsif /Spam Me: Yes/ {
                @send_partner_email[$id] = 1;
        } else {
                @send_partner_email[$id] = 0;
        }
}
# If you were not in the websignups list, you signed up before privacy
# policy, so we spam you (default=1)

In this case, there's a true "shrug" answer, which is hard to deal with.
We need to do something later on with the undefined case (no answer was
given, and no spam warning issued). This sort of logic deferral is
common to many uses of undefined values (or "NULL") in databases, even
when columns have defaults that are non-null.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
This message (c) 2003 by Aaron Sherman,
and granted to the Public Domain in 2023.
Fight the DMCA and copyright extension!


Reply via email to