I have the following code for a function
sub MysqlIN {
my %dateparts = ( YEAR => '', MONTH => '', DAY => '', @_, );
my $element;
foreach $element (%dateparts) {
if (!$dateparts{$element}) {
die "Invalid date value";
exit;
}
my $mysqldate = join ("-", $dateparts{YEAR}, $dateparts{MONTH}, $datep
+art{DAY});
return $mysqldate;
}
For some reason, the test inside the foreach loop is always true. What I want to accomplish with this function is simple: verify that the arguments have number values (not done yet) and that they are not empty.
Thanks for the help.