in reply to Strange behaviour - cgi related

mmm.. the ol' undef value in a hash def, eh?

this should fix it for you...

my $place = seewhatsthere( data => param('place') || '', field => 'Place', );

Update: Thanks duff! (lightbulb appears mystically above J's head) ..scary how you can go in completely the wrong direction and end up where you need to be..

cheers,

J

Replies are listed 'Best First'.
Re: Re: Strange behaviour - cgi related
by duff (Parson) on Dec 16, 2003 at 17:37 UTC

    Well, it's not an undef as his code would have worked properly in the first place; it's an empty list. But yes, || is another way to force a scalar context on param() such that it does the right thing when asked to return a multi-valued parameter. In fact, I like that method quite a bit :-)