Chas Owens wrote: > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: >> On Jun 1, 1:49 pm, [EMAIL PROTECTED] (Chas Owens) wrote: >> > On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:> On Jun 1, 11:21 am, >> >> > > and unscalable. (As soon as you add an 'else' clause, >> > > people have to read it two or three times to understand what's being >> > > done). Avoid at all costs. >> > >> > Which is why you never use an unless with an else. If you have >> > >> > unless ($foo) { >> > print "false\n"; >> > } >> > >> > and you find you need an else you change it to an if >> > >> > if ($foo) { >> > print "true\n" >> > } else { >> > print "false\n"; >> > } >> >> Thank you for proving my point for me. :-P >> >> Paul Lalli > > Umm, no, I didn't. I agreed with part of what you said. You should > never use an else with an unless, but unless by itself is better, in > my mind, than an if (!) and you can always change it to an if later if > you need to add an else.
In all honesty, I find removing a ! is easier than changing an if to unless, especially if just testing something quickly. Also makes it easier to search for. Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/