in reply to Re^2: XML::Twig Help
in thread XML::Twig Help
From your code I assume you are trying to type in a few XML filenames and the process them. First problem, if you only have 1 XML as a test, you need to open fields[0], otherwise open will fail with uninitialized value. Then once you fix that you are trying to open a file that's named the first line of the first file. You also don't need to open a file for XML::Twig, the module can do it itself. I would suggest starting simple, like take 1 XML file and create a simple perl script that opens it and does something with it. Something along the lines of:
Based on more assumptions looking at your code that you are trying to output to the second file given in the input, you can redirect later or at command line. Although I'm not sure how that behaves on windows nowadays. In any case you can also use $t->print_to_file($anotherfilename) and many other ways.#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $file = "yourxmlfilename.xml"; my $t= XML::Twig->new( twig_roots => { 'djn-geo' => 1}); $t->parsefile($file); $t->print;
|
|---|