Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: How to export hash to xml file

by zentara (Archbishop)
on Jan 14, 2009 at 12:28 UTC ( #736210=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to export hash to xml file
in thread How to export hash to xml file

Maybe you can use this example as a base:
#!/usr/bin/perl use warnings; use strict; # by jdporter of perlmonks, converts a dir tree to xml use File::Find; use XML::Simple; #my $root = shift or die "Usage: $0 rootdir\n"; my $root = shift || '.'; my %tree; find( sub { #print "$File::Find::name\n"; my @path = split m,/,, $File::Find::name; my $tree = \%tree; $tree = (($tree->{'dir'} ||= {})->{shift @path} ||= {}) while @path > ( -d _ ? 0 : 1 ); @path and # it's a file push @{ $tree->{'file'} ||= [] }, shift @path; }, $root ); print XMLout( \%tree );

I'm not really a human, but I play one on earth Remember How Lucky You Are

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://736210]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-08-15 01:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found