Bob O'Neill wrote:
<<Use list context:

  my @names = $q->param('name');

Cheers,
Ovid



I've found this thread very helpful, and have changed it to use Vars (from http://users.easystreet.com/ovid/cgi_course/) as I need a hash. This has replaced the following:

foreach $entry (param()) {
        $fieldhash{$entry}=param($entry);

        Checkentry(param($entry));
}

with:

my $q=new CGI;
my %fieldhash=$q->Vars;

which is much neater. My subroutine "Checkentry" untaints the input. Is there an easier way which will allow the hash values created by Vars to be passed to my subroutine without stepping through a "foreach" loop?

If I understand correctly then you want a hash reference to pass the whole hash around at once.

perldoc CGI

Should help, C<Vars> understands its context, so calling it in scalar context will result in it returning a hashref instead of a hash.

my $params_ref = $q->Vars;

http://danconia.org


Bob




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to