Storing form variables in global variables feels like a very bad idea to me, for the same reason any unrestricted set of global variables is a bad idea.
Personally I prefer a hash to store the form variables in, CGI.pm does support it, though its a rather new feature, and it's rather well hidden. Look up the method Vars. | [reply] |
Use a hash and don't abuse globals just to pass arguments. to paraphrase your code:
#!/usr/bin/perl -w
use strict;
check(qw(a b c));
sub check {
my %hash = (
a => 'here',
b => 'present',
c => 'me too',
);
for (@_) {
print "$hash{$_} has a value\n";
}
}
| [reply] [d/l] |
Thanks... ephiphony moment. I'm convinced to use strict refs and eliminate any symbolic usage.
package x actually is a static cache of prefs stored in a database refreshed only when those prefers are updated by a user.
Doing my stunt (above), I'm now using a hash to store all form fields and simply checking presence using the x list for that preference.
Thanks-Thanks.
| [reply] |