in reply to XML::Parser Error: invalid doc

AIndeed, you should use parsefile instead of parse in this case.

A shortcut is also to write directly my $twig= XML::Twig->parse( $fileLocation): in that case XML::Twig figures out that the argument to parse is not XML, so it looks for a file by that name.