$ perldoc HTML::TreeBuilder |grep -i space Do not represent the text content of elements. This saves space if $root->ignore_ignorable_whitespace(value) whitespace text nodes in the tree. Default is true. (In fact, I'd be $root->no_space_compacting(value) This determines whether TreeBuilder compacts all whitespace strings contiguous whitespace in the document is turned into a single space. But that's not done if no_space_compacting is set to 1. Setting no_space_compacting to 1 might be useful if you want to read Redirects to HTML::Element:: delete_ignorable_whitespace $ perldoc HTML::Element |grep -i space $h->delete_ignorable_whitespace() whitespace. You should not use this if $h under a 'pre' element. "\t", or some number of spaces, if you specify it). whitespace is deleted, and any internal whitespace is collapsed. This will not remove hard spaces, unicode spaces, or any other non ASCII white space unless you supplye the extra characters as a string Tabs are expanded to however many spaces it takes to get to the next 8th