in reply to Re: Regular Expression Help!
in thread Regular Expression Help!

but $var=""; and $var="data"; will both the in this IF, it doesn't work, I am trying to say if it is defined but empty move on.

Replies are listed 'Best First'.
Re^3: Regular Expression Help!
by Anonymous Monk on Jul 02, 2010 at 19:54 UTC
    I think this will do it:
    if ( ($var =~ /^\s+$/) or ($var eq "") ){ print "\n All \n"; }else{ print "\n Nothing \n"; }
      I don't understand why you won't just use:
      if ($var =~ /^\s*$/) { # Do blank procedure } else { # Do nonblank procedure }
        I was reading on this posting and found an interesting regular expression, can someone explain what is happening here?

        if ($var =~ /^\s*$/)


        Thanks!
Re^3: Regular Expression Help!
by Anonymous Monk on Jul 02, 2010 at 19:52 UTC
    I think this will do it:
    <code> if ( ($var =~ /^\s+$/) or ($var eq "") ){ print "\n All \n"; }else{ print "\n Nothing \n"; }