in reply to What is the best way to validate data ?
my @InvalidFields = grep {not defined CGI::param($_) or CGI::param($_) eq ''} CGI::param +();
@InvalidFields will now contain the names of any empty fields.
If you are not working with CGI, just replace the param calls with appropriate data structures.
Russmy @InvalidFields = grep {not defined $Hash($_) or $Hash($_) eq ''} keys %Hash;
|
|---|