Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Trying to check data entry to make sure something was entered. If something is entered then continue processing. So I want to use a regular expression that checks if there is NO Blank entries and if so then process: This is not working:
!^\s*$

Replies are listed 'Best First'.
Re: Check for non blank entry
by Roy Johnson (Monsignor) on Jan 05, 2006 at 18:04 UTC
    /\S/
    (capital S) will check for the presence of non-whitespace.

    Caution: Contents may have been coded under pressure.
Re: Check for non blank entry
by jZed (Prior) on Jan 05, 2006 at 18:29 UTC
    If nothing was entered, your $value might be undefined so better to do (defined $value and $value =~ /\S/).
Re: Check for non blank entry
by smokemachine (Hermit) on Jan 05, 2006 at 18:07 UTC
    !~ /^\s*$/ or =~ /\S/