http://qs321.pair.com?node_id=34251

rodry has asked for the wisdom of the Perl Monks concerning the following question:

I wrote functions to perform the INSERT, UPDATE, and DELETE queries in the database. They take the column values as named parameters.

Sometimes, in UPDATE and INSERT queries, I do not have values for all the columns. I would like the function to simply use the default value I assign to them in the hash of values, like this:

sub function_sql { my %values = ( VALUE1 => 'one value', VALUE2 => 'two values', @_ );

You get the idea. For example, let's say I only pass it arguments for VALUE1. I would like VALUE2 to contain "two values". However, the @_ seems to replace it with UNDEF.

Thanks. PS: If you know of a better way to accomplish this task (have functions do the SQL for you), I would also like to hear them.