in reply to Re: Want DBI to load empty strings as NULL
in thread Want DBI to load empty strings as NULL

That will also convert the string 0 into undef. Fix:
$sth->execute( map { defined($_) && length($_) ? $_ : undef } @seen_values );
or
$sth->execute( map { no warnings 'uninitialized'; length($_) ? $_ : undef } @seen_values );

Replies are listed 'Best First'.
Re^3: Want DBI to load empty strings as NULL
by jdrago999 (Pilgrim) on Feb 15, 2010 at 21:40 UTC

    YES DO THIS

    If map is unfamiliar territory, just look up some examples of using map and grep functions on lists (like your list of arguments for execute()).

    Also - don't add single-quotes to your values - they will be added automatically (if necessary) for you.