sub MonthlyMaxTempSpellMessage{ my $month = shift; #print "\n$month"; $month = "-$month-"; #print "\n$month"; my $xp = XML::XPath->new(filename =>'weather_records.xml'); my @data=(); my $nodes = $xp->findnodes("//DailyWeatherRecord [contains(date,'$month')]"); foreach my $node($nodes->get_nodelist){ push @data, [$xp->findvalue(".//date",$node),$xp- >findvalue(".//maxdrybulb /\@number",$node)]; } for my $aref ( @data ) { print "\t [ @$aref ],\n"; }