D
Denis Valdenaire
Hello,
Here is my problem. I have a "data" in perl (I said a "data", because
i don't know WHAT it is. I know what it is not : not an ARRAY ref, not
an ARRAY, not a HASH ref, etc. etc. Every attempt i made to parse it
fails with an error message of that kind.), that was provider by
XML::Simple::XMLIn();
Let's consider the code :
#!/usr/bin/perl
use XML::Simple;
use Data:umper;
$xml = '<configuration>
<sync_method type="common">
<sync_modules>
<ena name="was6"/>
<ena name="wasconf"/>
<dis name="ihs"/>
</sync_modules>
</sync_method></configuration>';
my $config = XMLin($xml, KeyAttr => "");
print Dumper($config->{sync_method}->{sync_modules}->{ena});
That gives me the following output (THE VERY "data") :
$VAR1 = [
{
'name' => 'was6'
},
{
'name' => 'wasconf'
}
];
My question : what i am supposed to do if i want to parse each name ?
like, processing was6 and then wasconf and then stop.
I believe I tried everything (keys, foreach, each, #{@->{%}}, etc...).
Do I do it the wrong way ?
Any suggestion is very welcome !
Here is my problem. I have a "data" in perl (I said a "data", because
i don't know WHAT it is. I know what it is not : not an ARRAY ref, not
an ARRAY, not a HASH ref, etc. etc. Every attempt i made to parse it
fails with an error message of that kind.), that was provider by
XML::Simple::XMLIn();
Let's consider the code :
#!/usr/bin/perl
use XML::Simple;
use Data:umper;
$xml = '<configuration>
<sync_method type="common">
<sync_modules>
<ena name="was6"/>
<ena name="wasconf"/>
<dis name="ihs"/>
</sync_modules>
</sync_method></configuration>';
my $config = XMLin($xml, KeyAttr => "");
print Dumper($config->{sync_method}->{sync_modules}->{ena});
That gives me the following output (THE VERY "data") :
$VAR1 = [
{
'name' => 'was6'
},
{
'name' => 'wasconf'
}
];
My question : what i am supposed to do if i want to parse each name ?
like, processing was6 and then wasconf and then stop.
I believe I tried everything (keys, foreach, each, #{@->{%}}, etc...).
Do I do it the wrong way ?
Any suggestion is very welcome !