sub RainSoFarMessage{
my $ulimit = shift;
#print "\n$ulimit";
my $xp = XML::XPath->new(filename
=> 'weather_records.xml');
my @totrain=();
my $nodes;
for ($month=1;$month<=$ulimit;$month++){
#print "\n$month";
my $pattern = "$month-";
#print "\n$pattern";
$nodes = $xp->findnodes("//MonthlyWeatherRecord
[contains(date,'$pattern')]");
foreach my $node($nodes->get_nodelist){
push @totrain,$xp->findvalue(".//totalrainfall/
\@number",$node);
}
}
#print "\n@totrain";
my $total=0;
#print "\n$total";
foreach my $t(@totrain){
#print "\n$t";
$total=$total + $t;
#print "\n$total";
}
return $total;
}
####
my $monthrs = 2;
my $totalrs = RainSoFarMessage($monthrs);
#print "\n$totalrs";
my @RainSoFarMesg=();
push @RainSoFarMesg,$monthrs,$totalrs;
#print "\n@RainSoFarMesg";
####
Operation `+': no method found,
left argument has no overloaded magic,
right argument in overloaded package XML::XPath::Literal at C:\..\..\xmlrecord_parse.pl line 480.
Tool completed with exit code 255
####
weather_records.xml
-
-
1-1-2004
-
-
2-1-2004
-
-
1-2-2004
-
-
2-2-2004
-
-
1-2004
-
-
2-2004
-