Topic: perl..huh?
trying to make perl script to pull data from xml HERE
Cant get it to work...I either need a good howto, or some help, or both!
my failed script:
#!/usr/bin/perl
# declare vars
$league_id = $ARGV[0];
$lang = "en-US"; #change if you need
# declare helpers
sub trim($);
# use module
use XML::Simple;
# create object
$xml = new XML::Simple;
# read XML file
$uri = "http://www.footbo.com/widgets/xml/teamgames.aspx?id=194276".$league_id."&LANGUAGE=".$lang;
$file = `curl -s --connect-timeout 45 $uri`;
$standings = $xml->XMLin($file);
# print table info
print " NAME";
print " MAN U";
print " THEM";
print "\n";
# print games
$node = "pastgames";
# for ($i=0; $i <20; $i++)
{
$name = $node->{game}->{guestteam}->{Fullname};
$manu = $node->{game}->{hometeam}->{score};
$them = $node->{game}->{guestteam}->{score};
print "$name";
print "$manu";
print "$them";
print "\n";
}
# helpers
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}I just want it to show Date, Games, Score, such as:
4.2.09
Man U - 99
Chelsea - 0
4.3.09
Man U - 98
Liverpool - 1
(and so on)