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