[Omaha.pm] CGI.pm param() gotcha

Andy Lester andy at petdance.com
Thu Oct 27 19:12:48 PDT 2005


>> Because the first way sends scalar references into the passed  
>> hashref,
>> and the second sends scalar values into the passed hashref?

That's exactly right.

> What I do know is that CGI.pm is pretty weird. In scalar context if a
> param is not set param() returns undef. In array context if a param is
> not set param() returns *an empty array*.

That's right, and it's the Perl way.  In both cases, (undef and empty  
array), the result evaluates to false.  If it returned a one-element  
array, then that would evaluate to one, which is true.

xoxo,
Andy

-- 
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance




More information about the Omaha-pm mailing list