http://www.perlmonks.org?node_id=171383


in reply to Searching Strings for Characters

What exactly are you looking for in the string? All of the things you mentioned are fairly easy to detect:

String with all whitespace:

if ($string =~ /^\s+$/)

Or, to get rid of whitespace in the beginning of a string:

$string =~ s/\s+(\w.*)/$1/;