larthana has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I am using unix platform to develop simple perl xml program. SunOS 5.9 is the unix version. Also i have installed perl 5.6.1. but i couldnt find the XML package in /usr/perl5/5.6.1/lib. Is this version support XML programming in perl?.

Below is the simple XML program.

use XML::Simple; use Data::Dumper; # create array @arr = [ {'country'=>'england', 'capital'=>'london'}, {'country'=>'norway', 'capital'=>'oslo'}, {'country'=>'india', 'capital'=>'new delhi'} ]; # create object $xml = new XML::Simple (NoAttr=>1, RootName=>'data'); # access XML data print Dumper($data);

Ouput:

Can't locate XML/Simple.pm

Can anyone of you help me what am doing wrong?

20070116 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: xml support version
by shigetsu (Hermit) on Jan 16, 2007 at 07:16 UTC

    Assuming you're running a Linux-alike system:

    Since XML::Simple doesn't ship with standard Perl , type

    perl -MCPAN -e shell

    at the console, follow the instructions (if you haven't setup the CPAN installer) and issue a

    install XML::Simple

    when you're done with configuring.

    Make sure you have root permissions when installing.

Re: xml support version
by marto (Cardinal) on Jan 16, 2007 at 11:29 UTC
    larthana,

    In addition to the great advice you have already been given, you may want to take a look at some of the nodes from Installing Modules in the Tutorials section of this site.

    Hope this helps

    Martin
Re: xml support version
by davorg (Chancellor) on Jan 16, 2007 at 09:10 UTC

    Please read Writeup Formatting Tips and follow the advice there when posting to Perl Monks. You are far more likely to get help when your node is well-formatted and easy to read.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg