Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Default values in functions argumentsby rodry (Beadle) |
on Sep 27, 2000 at 21:56 UTC ( [id://34251]=perlquestion: print w/replies, xml ) | Need Help?? |
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:
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.
Back to
Seekers of Perl Wisdom
|
|