I do this in my cgi perl script:
my %USER_HTML_INPUT = Vars();
I noticed that if have an array of data assigned to one key it becomes like this:
$VAR= {'tempvalue' => '0�25�85�125' };
If i do @开发者_Go百科DATA = param('tempvalue'); It splits the values into the array.
How can I do the same operation without using param function.?
If you really, really want to do this without param
, you could try something like (untested):
my $vars = Vars();
my %USER_HTML_INPUT = map { $_ => [ split(m{\0}, $vars->{$_}) ] } keys %$vars;
but slightly less ugly:
my %USER_HTML_INPUT = map { $_ => [ param($_) ] } param();
It is much cleaner, though, to simply use param
on the parameters that you need.
Also read the section DEBUGGING of the CGI documentation to see how you can pass CGI parameters to a script using CGI.pm from the command-line.
精彩评论