in reply to Unexpected Hash Assignment using cgi->params
In list context, when the key isn't present, the param method returns an empty list rather than undef. Put the param calls in scalar context and all will be well:
Can you save yourself some work by looping over the params list and deriving your key names by substr or substitution?use CGI; my $cgi = CGI->new( user_name => 'foobat' ); my %data = ( email => scalar( $cgi->param('user_email')), name => scalar( $cgi->param('user_name')) ); print "@{[keys %data]}\n"; __END__ email name
After Compline,
Zaxo
|
|---|