in reply to XML::Twig Help
The error you get comes from the fact that you need to quote djn-geo, as it doesn't look like a bareword to Perl.
That said there are many other problems with your code. I suspect what you want is something like this (untested):
#!/usr/bin/perl use strict; use warnings; use XML::Twig; # get the user input. die if it doesn't look right my $enter = <STDIN>; my @fields = split(/ /, $enter); if( @fields != 2) { die "usage $0 <input_file> <output_file>\n"; } # no need to open the file, quote djn-geo my $t= XML::Twig->new( twig_roots => { 'djn-geo' => 1}); $t->parsefile($fields[0]); # print_to_file was added in XML::Twig 3.23 $twig->print_to_file( $fields[1]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig Help
by shravnk (Initiate) on Jul 06, 2010 at 17:17 UTC | |
by AndyZaft (Hermit) on Jul 06, 2010 at 18:13 UTC |