in reply to undef and empty variables

I am trying to make sure the field in which the variable will populate into a database contains "null".

A NULL, or the string "null"? The following will convert empty strings to undef which database modules view as NULL.

sub empty_to_undef { return defined($_[0]) && !length($_[0]) ? undef : $_[0]; }

or

sub empty_to_undef { no warnings 'uninitialized'; return length($_[0]) ? $_[0] : undef; }

My assumption is that undef variables would be translated into "" (empty string) upon its use within Perl and not require the use of the defined function.

Undef does stringify to the empty string, but a warning is issued when this happens. Disabling this warning globally is unwise, though.