This page was exported from phaq
[ http://phaq.phunsites.net ] Export date: Sat Jun 10 1:08:01 2023 / +0000 GMT |
For a project of mine, I wanted to convert a Perl data structure, a so called Hash of Hashes, into an XML. The simple solution to this is to use the XML::Dumper module. Let's suppose your data structure looks like this: %hash_of_hashes = { You can easily convert this into an XML representation using this command:
So you'll end up with this output: <perldata> But be aware: You need to pass the hash by reference, imposing the %hash_of_hashes notation, otherwise you end up with something like this: <perldata> It's so obvious, but I had overlooked that as well in the first attempts ;-) |
Powered by [ Universal Post Manager ] plugin. HTML saving format developed by gVectors Team www.gVectors.com |