> ----- Original Message -----
> From: Brad Baxter
> Sent: 04/16/10 01:31 AM
> To: beginners@perl.org
> Subject: Re: XML Parser Error
> 
On 4/15/2010 1:40 PM, Open Source wrote:
> I'm getting this error:
>
> Undefined subroutine&XML::Simple::XMLin called at ./sample.pl line 3.
>
> Here's my code and input file:
>
> use XML::Simple;
> use Data::Dumper;
> $data = XMLin("sample.xml");
> print Dumper($data);
>
> <?xml version='1.0'?>
> <employee>
> <name>John</name>
> <age>43</age>
> <gender>M</gender>
> <department>Operations</department>
> </employee>

There must be something else going on.
Works okay for me:

 >> cat qt
#!/usr/local/bin/perl

use warnings;
use strict;

use XML::Simple;
use Data::Dumper;
my $data = XMLin("sample.xml");
print Dumper($data);

 >> ./qt
$VAR1 = {
 'department' => 'Operations',
 'name' => 'John',
 'age' => '43',
 'gender' => 'M'
 };

Thanks Brad/Steve, I had an issue in sourcing the XML::Simple from my 
distributed platform. I've redownloaded the module and my code now works!

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to