Thread XML - STRING - HASH (2 answers)
Opened by Dakarus at 2014-03-05 13:37

GwenDragon
 2014-03-05 13:58
#173851 #173851
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Mit CPAN:XML::Simple kannst du aus dem XML einen Hash erzeugen.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
use strict;
use warnings;
use XML::Simple;

# $ref ist eine Referenz auf den erzeutgten Hash
my $ref = XMLin('<CQA><INFO><owner>USERNAME</owner><name>STRESS TEST</name><description>PERL BUTLER STRESS TEST</description><date>2014-12-13</date><status>1</status><version>9.08</version></INFO><LOG><message>CODE INFO 1</message></LOG></CQA>');

use Data::Dumper;
print Dumper $ref;


Ergibt:
$VAR1 = {
'INFO' => {
'owner' => 'USERNAME',
'version' => '9.08',
'status' => '1',
'date' => '2014-12-13',
'name' => 'STRESS TEST',
'description' => 'PERL BUTLER STRESS TEST'
},
'LOG' => {
'message' => 'CODE INFO 1'
}
};

View full thread XML - STRING - HASH