Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Tried variations of ....

Why not post what you tried?

#!/usr/bin/perl -- use strict; use warnings; my $foops = { "xmlout.xml" => { "/panoply/classes" => [ "\n <classes name=\"Panoply::AccessLog +ic\">\n <all_members name=\"accessLogic\" protection=\"public\" sc +ope=\"Panoply::AccessLogic\" virtualness=\"non_virtual\"/>\n </clas +ses>", "\n <classes name=\"Panoply::Details:: +ActionBatch\"></classes>", ], "/panoply/files" => [ "\n <files name=\"AccessLogic.hpp\"></ +files>", "\n <files name=\"BaseDevice.h\"></fil +es>", ], "/panoply/namespaces" => [ "\n <namespaces name=\"std\"></namespa +ces>", ], }, }; print $foops, "\n"; print $foops->{"xmlout.xml"}, "\n"; print $foops->{"xmlout.xml"}{"/panoply/classes"}, "\n"; print $foops->{"xmlout.xml"}{"/panoply/classes"}[0], "\n"; print $foops->{"xmlout.xml"}{"/panoply/classes"}[1], "\n\n"; use Data::Diver qw( Dive ); my $classes = Dive( $foops, "xmlout.xml", "/panoply/classes" ); print $classes, "\n"; print scalar @{$classes}, "\n"; print @{$classes}, "\n\n"; while( my( $filename, $datahash ) = each %$foops ){ print "$filename => $datahash\n"; while( my( $branchname, $brancharray ) = each %$datahash ){ printf "%-20s => n(%3d) => %s\n", $branchname, scalar(@$brancharray), $brancharray; } } __END__ HASH(0x9ad1bc) HASH(0x99a36c) ARRAY(0x3f8a8c) <classes name="Panoply::AccessLogic"> <all_members name="accessLogic" protection="public" scope="Panoply +::AccessLogic" virtualness="non_virtual"/> </classes> <classes name="Panoply::Details::ActionBatch"></classes> ARRAY(0x3f8a8c) 2 <classes name="Panoply::AccessLogic"> <all_members name="accessLogic" protection="public" scope="Panoply +::AccessLogic" virtualness="non_virtual"/> </classes> <classes name="Panoply::Details::ActionBatch"></classes> xmlout.xml => HASH(0x99a36c) /panoply/namespaces => n( 1) => ARRAY(0x99a2fc) /panoply/files => n( 2) => ARRAY(0x99a26c) /panoply/classes => n( 2) => ARRAY(0x3f8a8c)

TutorialsData Types and VariablesData Type: ArrayData Type: HashReferences quick reference


In reply to Re^5: XML::Twig traversing tree and storing in an array by Anonymous Monk
in thread XML::Twig traversing tree and storing in an array by jccunning

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and monks are getting baked in the sun...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (2)
    As of 2018-07-21 06:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















      Results (444 votes). Check out past polls.

      Notices?