Not able to read XML using perl -
i trying read xml file using perl.
i tried xml::simple , use xml::libxml, in both cases facing problems.
for xml::simple says
"keys on reference experimental using hash reference deprecated" when use following
foreach $k ({keys %$ref->{version}}) # output conf { print stderr dumper($k); } and xml::libxml, getting "can't locate xml/libxml/error.pm in @inc (you may need install xml::libxml::error module)".
when tried install libxml using activeperl ppm ui, didn't find package there. downloaded libxml other source , copied required files in "c:\perl64\lib" , "c:\perl64\site\lib".
i using perl 5, version 20. how can make work ?
your xml::simple problem misunderstanding of syntax. looks realise need use % dereference hash reference, don't realise need put expression returns hash reference in small { ... } block.
so have:
%$ref->{version} you want:
%{$ref->{version}} oh, , it's worse that. have { ... } around expression - you're explicitly turning expression hash reference. want is:
foreach $k (keys %{$ref->{version}}) each value in $kwill hash key. , hash keys strings. call dumper in next line unnecessary too.
Comments
Post a Comment