in reply to Is a file XML?

That's pretty much how I'd do it. Using code like this:

use XML::Parser; my $p = XML::Parser->new; my $file = 'whatever.xml'; eval { $p->parsefile($file) }; if ($@) { # XML is not well formed } else { # XML is well formed }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you don't talk about Perl club."