foo.pl: #!/usr/bin/perl use strict; use warnings; use XML::XSLT qw( ); use Object::Destroyer qw( ); my $xslt = Object::Destroyer->new( XML::XSLT->new('foo.xslt', warnings => 1), 'dispose', ); $xslt->transform('foo.xml'); print $xslt->toString;