![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Validating the contents of scalars using an array based listby JPaul (Hermit) |
on Apr 03, 2003 at 17:03 UTC ( #247809=perlquestion: print w/replies, xml ) | Need Help?? |
JPaul has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Monks; The title isn't terribly descriptive, and I couldn't think of anything better in such a short space... At any rate, this issue: I'm working on a set of CGIs which read in a number of vars from a FORM submit. I have a list of vars which cannot be empty, so after I read in all the var's using ->param(), I have something like this: Now I've been told that this list of non-empty fields can change depending on the whim of the customer. Therefore I need to have a better, less hard-coded, way of checking the vars. The list of vars that must be non-empty will be imported from DBI, since everything is database based anyway. My problem is trying to work out a tidy way of actually taking this list of fields and comparing it to the bunch of scalars I have. I could make a hash, and have some kind of routine to check over the hash, ala: But that is somewhat untidy, as you can see. How would you do the above?
My thanks,
Back to
Seekers of Perl Wisdom
|
|