Programming Tips - How can I check a string for all whitespace or not in Perl?

Date: 2016dec15 Language: perl Q. How can I check a string for all whitespace or not in Perl? A.
sub isSpace($) { return $_[0] =~ m/^\s*$/; } sub hasContent($) { return ! isSpace($_[0]); }
If you want a less robust check that only looks for a zero length string
sub isNonEmpty($) { # is this string not '' return length($_[0]); }
sub isEmpty($) { # is this string '' return ! isNonEmpty($_[0]); }