Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: How on earth do I use this script

by remiah (Hermit)
on Sep 27, 2012 at 22:00 UTC ( #996083=note: print w/replies, xml ) Need Help??

in reply to How on earth do I use this script


I tried this but I saw this script works just fine. How do you invoke the program? I did like this.

perl target.xml SOMETHING 1
With XML::Twig, similar things would go like this.
use strict;use warnings; use XML::Twig; my $xmlfile=$ARGV[0]; my $values_flag=$ARGV[0] || 0; my $twig =XML::Twig->new( twig_handlers => {'//*' => sub { my($twig,$elt)=@_; if ( $elt->descendants == 1 ){ print $elt->path; print " := " . $elt->first_child_text if ( $values_fla +g ); print "\n"; } } }, )->parsefile($xmlfile);

Replies are listed 'Best First'.
Re^2: How on earth do I use this script
by diamondsandperls (Beadle) on Sep 27, 2012 at 22:21 UTC
    thanks got it to go

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996083]
[Corion]: LanX: Ah, yeah - Frankfurt is in the quake region, but at the very border. I think I've never noticed a quake in Frankfurt myself
[marto]: good morning all
[Corion]: On another topic, in the process of Rubber Duck SoPWing, I wrote a post about the best API for generating HTTP requests (not sending them) and while writing it and fleshing out my sample implementation, I came up with some improvements to my ...
[Corion]: ... existing prototype. Cartesian Products will be proud of that module once it gets out ;)
[Corion]: Hi marto ;)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2017-01-18 10:16 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (161 votes). Check out past polls.