in reply to Re: What is the best way to determine if a string is blank?
in thread What is the best way to determine if a string is blank?
I think you meant:my $foo = " bar"; if($foo =~ /\S/) { print "Whitespace only\n"; }
Update: Whoops, davorg is right (see below)... and easier to see. I was thinking \s instead of \S. Fixed above, but hokey, so use his code instead.my $foo = " bar"; if($foo =~ /^\s+$/) { print "Whitespace only\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: What is the best way to determine if a string is blank?
by davorg (Chancellor) on Jan 03, 2001 at 23:49 UTC |