On Thu, 19 Aug 2004 17:52:18 +0200, Juerd <[EMAIL PROTECTED]> wrote:
> Ouch. You have foo-bar-baz code *at work*? :)

Unfortunately, some of the code here is much worse than that.

> In fact, this was anticipated and the doesn't-exist case is explicitly
> documented as:
> 
>     If the parameter does not exist at all, then param() will return
>     undef in a scalar context, and the empty list in a list context.

Sure enough. And I've even read a large percentage of the (unwieldy)
CGI.pm docs. But I was using C<param> as an example. The behavior
would exist with any subroutine that used C<return;>.

> > I can't imagine how much trouble this would have caused me if I didn't
> > know about the C<return;> special case.
> 
> There is no need to know about the special case, because you can read
> exactly how it works in the documentation.

The point that it's documented for C<param> and for C<return> doesn't
remove the fact that while this DWIM the majority of the time, it can
be the cause of a subtle bug. I'm sure many people don't know about
the DWIM behavior. Or aren't actively aware of it.

> >     my $string = join "," => @array;
> 
> my $string = join "," <== @array;
> 
> It's a 180, but it'll workforme.

I think I'm going to go with C< @array.join(",") >. :)

--
matt

> 
> Juerd

Reply via email to