Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First of all, my congratulations for discovering Data::Dumper, you will never go anywhere without it ;)
This is a common problem with CGI's param method. It's being called in list context in this case. If the CGI form did not include a value for rs$i, then param("rs$i") in list context will return an empty list. The empty list just gets flattened away in a hash construction: This explains the output you're getting. You can fix it by forcing scalar context: At some point, this problem has bitten everyone who's ever done CGI programming with CGI.pm, and I wish there were an option to pass to CGI.pm to force scalar context behavior for all calls to param. I rarely use forms where multiple fields are named the same, so param's list context is rarely useful for me... Now that I think of it, I will probably start changing the tops of my CGI scripts from now on:
blokhead In reply to Re: Problem assigning values to Hash
by blokhead
|
|