rodry has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Validating hash values
by reptile (Monk) on Sep 16, 2000 at 03:13 UTC | |
|
Re: Validating hash values
by tye (Sage) on Sep 16, 2000 at 03:18 UTC | |
|
(crazyinsomniac) Re: Validating hash values
by crazyinsomniac (Prior) on Sep 16, 2000 at 03:12 UTC | |
|
Re: Validating hash values
by geektron (Curate) on Sep 16, 2000 at 03:21 UTC | |
by tye (Sage) on Sep 16, 2000 at 03:23 UTC | |
|
(ar0n) Re: Validating hash values
by ar0n (Priest) on Sep 16, 2000 at 03:24 UTC | |
|
Re: Validating hash values
by isotope (Deacon) on Sep 16, 2000 at 03:14 UTC | |
by Adam (Vicar) on Sep 16, 2000 at 03:32 UTC | |
|
RE: Validating hash values
by runrig (Abbot) on Sep 16, 2000 at 03:25 UTC |