use XML::Tidy; XML::Tidy->new('xml'=>$AuthnRequestXML)->tidy()->toString();