[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Drunk Driving redux (what was he thinking?)




On 28 Jun 1999, Randal L. Schwartz wrote:

> Steve>     $phdfiles{$fname} ||= '';
> 
> No, those are absolutely not the same.  Consider $phdfiles{$fname} of "0".

It appears I'm not only wrong, but I'm "absolutely" wrong.

For my purposes (web), this technique works fine. Since I have total
control over the input, I consider 0, "" and undef to be the same thing,
for reasons of safety and flexibility. The technique doesn't apply here,
though, you're right.

So I'll amend my original submission to have the following line instead:

  $phdfiles{$fname} = '' if not defined $phdfiles{$fname};

A little more verbose, but I don't know of a simpler way to put it. Any
thoughts?


==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org