|The stupid question is the question not asked|
Re^5: Context aware functions - best practices?by LAI (Hermit)
|on Jan 15, 2003 at 14:33 UTC||Need Help??|
Ugh, that's the worst of both worlds
Hurrah for nauseatingly ugly code...
Anyway, yeah. The return type would definitely have to be the same regardless of the args. Having to test the type every time a sub is called is unacceptable. How does CGI's $calar = $cgi->param() decide which value to return, though (if it's a multivalue parameter)? Is it just the first (or last) one input?
I just RTFM'd and RTFSource'd, and CGI->param() does this:
There you have it, I guess. Return the whole array or the first element. I still like Zaxo's idea of returning @rray[-1], though... I guess it depends what sub foo does.