use HTML::Entities; my $html = ' '; my $text = HTML::Entities::decode_entities($html); print "\$text = '$text'\n"; my $whitespace = "[\s\240]"; if ($text =~ /^$whitespace$/) { print "yes\n"; } else { print "no\n"; }