>>>>> "7" == 7  <7stud.7s...@gmail.com> writes:

  7> On Mon, Feb 8, 2010 at 6:19 PM, Uri Guttman <u...@stemsystems.com> wrote:
  >>>>>> "7" == 7  <7stud.7s...@gmail.com> writes:
   
  7>      7> if (defined $var && ($var eq '' || $var eq '0')) {
   
  7>      7>     #code
   
  7>      7> }
   
  7>      7> to handle cases where $var = undef.  undef acts like it is a blank
  7>      7> string when used as a string.
   
  7>     blah..
   
  7>            unless( $var ) {
   
  7>     is all you need for that situation. you are already testing three of 
the
  7>     four allowed false values. and the numeric 0 would be covered under the
  7>     eq '0' test anyhow.
   
  7>     newbies should be taught perl's boolean false values early on.

  7> Because unless and until statements are harder to maintain, NO ONE
  7> should use them--least of all beginners.

they both read fine in english which is why they we included by
larry. regardless, your checking of three booleans when one check (in
positive or negative fashion) was my main point there.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to