tags:

views:

62

answers:

2

Is there a Perl module to get the avg. temperature for any given zipcode? For instance, Wikipedia has the Avg. high, avg. low & daily mean temperature for Los Angeles.

I'd like to do this in Perl somehow but can't find a module to do this (e.g. type in 10001 and get the avg. temp. for New York).

A: 

http://www.melissadata.com/lookups/ZipWeather.asp?ZipCode=XXXXX

For New York: http://www.melissadata.com/lookups/ZipWeather.asp?ZipCode=10001

Then curl and parse the result...

drewk
@downvoter: why?
drewk
+5  A: 

Searching CPAN for "weather" gives you a ton of options including Google Weather, weather.com and Weather Underground.

Most of these are just fetching a URL and parsing the resulting XML or JSON. So if you don't want to use the modules you can do it manually using LWP::Simple and either XML::Simple or JSON::Any to parse the result.

Schwern
@Schwern: It is true those modules exist, but the question was for "the average weather" which is based on historical weather. Weather Underground, I think, is the only one of those three with "average" or historical weather, and WU's average is based on airport location -- not ZIP. Update: Never mind. Sorry. I located the "average" on weather.com and it was better than what I used.
drewk
Oh, I missed the part where they specifically wanted average weather.
Schwern