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

  7> if (defined $var && ($var eq '' || $var eq '0')) {

  7>     #code

  7> }

  7> to handle cases where $var = undef.  undef acts like it is a blank
  7> string when used as a string.

blah..

        unless( $var ) {

is all you need for that situation. you are already testing three of the
four allowed false values. and the numeric 0 would be covered under the
eq '0' test anyhow.

newbies should be taught perl's boolean false values early on.

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