in reply to CGI.pm: Can param return array ref?

You have to explicitly program the logic, but it's not as simple as you'd like.

CGI.pm explicitly returns you either a scalar, or if you ask for it and it's multivalued, then a list. It inherently can't know whether a parameter must be single valued, or just happens to be.

What this means to you is that you should likely use
@values = param('foo');
and condition on list length of more than one. Better yet, keep track of which parameters *should* be multivalued, or use a naming convention like Hungarian.

All the best,
Gremio

mail q.gremio..q.@..q.speakeasy..q@.@.q.org.;
  • Comment on Re: CGI.pm: Can param return array ref?