Re: Perl

From: Scott Walde <scott_at_no.spam.please>
Date: Thu Jul 20 2006 - 22:08:32 CST

Dave Hall wrote:

>
>There may already be code to go from XML into a perl hash, I've never had to
>do it in perl.
>
>
>
Yes there is. I did this recently on a project. The module I used is
XML::Simple.

Some snippets of my code:

use XML::Simple;
use LWP::Simple;

my $xml = get("$url?$arg");
my $ref = XMLin($xml);
print $ref->{'team'}->{'GameDate'}."\n";
foreach(sort keys %{$ref->{'turbine'}})
{
    print "$_: ";
    print $ref->{'turbine'}->{"$_"}->{'style'}.": ";
    print $ref->{'turbine'}->{"$_"}->{'ttid'}."\n";
}
Received on Thu Jul 20 22:08:35 2006

This archive was generated by hypermail 2.1.8 : Fri Sep 08 2006 - 23:26:38 CST