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]); }