in reply to What should this do?
Unfortunately, this is a frequent gotcha in exactly the situation you show. (It's gotten me at least once!) The hash would also be messed up if the parameter returned more than one value. The solution is to call param() in scalar context, e.g.:
or to create an anonymous array, if appropriate:my %hash = ( 'key1' => 'value1', 'key2' => scalar $r->param('doesnt_exist'), 'key3' => 'value3', );
my %hash = ( 'key1' => 'value1', 'key2' => [ $r->param('multi_valued') ], 'key3' => 'value3', );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: What should this do?
by tye (Sage) on Dec 05, 2001 at 10:18 UTC | |
by TheDamian (Vicar) on Dec 06, 2001 at 08:40 UTC | |
by JackHammer (Acolyte) on Sep 10, 2003 at 04:07 UTC |