Thanks Brett, that's very handy to know! Cheers, -Shannon
> From: "Brett W. McCoy" <[EMAIL PROTECTED]> > Date: Mon, 15 Oct 2001 23:53:56 -0400 (EDT) > To: Shannon Murdoch <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Subject: Re: (simple) cgi.pm question > > On Tue, 16 Oct 2001, Shannon Murdoch wrote: > >> So far my script puts every form item in to it's own variable, and calls >> upon that variable when it is writing the tab-delimited file (which will be >> used in Exel or SPSS etc for data analysis. >> >> Is there an easier way to do this than I have? > > You betcha! There's a method in the CGI module called Vars, which returns > all of the form variables into a hash. Note that it does have a capital > letter V. > > my $cgi = new CGI; > > my %params = $cgi->Vars; > > If you use the functional interface, you will need to import the keyword > :cgi-lib to use Vars as a function: > > use CGI qw(:standard :cgi-lib); > > my %params = Vars; > > Then you can access your paramters as $params{q1_1}, $params{q1_2}, etc., > and easily loop threm as necessary. > > -- Brett > http://www.chapelperilous.net/ > ------------------------------------------------------------------------ > If you stand on your head, you will get footprints in your hair. > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]