Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: Validating hash values

by runrig (Abbot)
on Sep 16, 2000 at 03:25 UTC ( [id://32766]=note: print w/replies, xml ) Need Help??


in reply to Validating hash values

Update: Never mind, there's enough responses here already

As mentioned before, you need to change that loop. Here is my offering:

sub MysqlIN { # Why is that '@_' in there, are you passing in an # array of three values? # That's what I'll assume, so I'll change this line #my %dateparts = ( YEAR => '', MONTH => '', DAY => '', @_, ); # To this: my %dateparts = ( YEAR=>shift, MONTH=>shift, DAY=>shift ); my $element; while (my ($name, $value) = each %dateparts) { # Number validation added die "Invalid value for $name" unless $value and $value=~/^\d+$/; # You don't need to exit, you already died! # exit; } my $mysqldate = join ("-", @dateparts{qw(YEAR MONTH DAY)}); return $mysqldate; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://32766]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found