SPUG: question regarding using reg exp in "if" statements.
Jim Traugott
jtraug at seanet.com
Fri Sep 10 16:40:54 CDT 1999
How about:
if ($string =~ /^\s*$/)
jim
>>>>> "Daniel" == Daniel V Ebert <debert at dusya.osd.com> writes:
> I have written an "if" statement:
> if ($string eq "") { whatever;}
> else{ something else;}
> to check for blank entries in a form CGI. This works except that " "
> doesn't satisfy the if statemenet condition.
> What I really want is (in plain English) is:
> if ($string is only white space)
> I've tried stuff like:
> if($string eq /\s/)
> if($string ne /\w/)
> if($string eq m/\s/)
> if($string ne m/\w/)
> etc.
> but they don't work. I'm probably missing something obvious, but I can't
> figure it out. Any help would be appreciated. Thanks.
> ---
> Dan Ebert <debert at seanet.com> or <mathin at mathin.com>
> Seanet Internet Services
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list