Fellow Monks,
There's probably an easy answer to this, I have an xml file, for example:
<?xml version="1.0"?>
<?leverage formatversion="1.0"?>
<config servertype="sunhosts" reporttype="patches and levels" >
<server name="atlas" osname="solaris" osversion="2.8">
<address>192.168.0.2</address>
<address>192.168.0.22</address>
<address>192.168.0.222</address>
<patchlevel>Generic</patchlevel>
<perlversion>5.6.1</perlversion>
</server>
</config>
I want to put the address values into a scalar, the equivalent of say:
$address="192.168.0.2 192.168.0.22 192.168.0.222";
I can pull these out one-at-a-time when I use:
$config->{server}{atlas}{address}->[0];
I thought just using
$config->{server}{atlas}{address}
would give me the result I was looking for, but it just returns a hash reference, I think. Is there an easy option to do this, or will I have to use a foreach loop?
Thanks
Jonathan
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, details, 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, summary, 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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.