in reply to Replace html nodes

Web::Query has a replace_with method.