#!/usr/bin/perl use strict; use LWP; use XML::Simple; use Data::Dumper; my $var_lat = "45.96968"; my $var_lon = "-93.33434899999997"; my $ua = LWP::UserAgent->new; my $forecast_xml = $ua->request(HTTP::Request->new(GET => "http://forecast.weather.gov/MapClick.php?lat=$var_lat&lon=$var_lon&unit=0&lg=english&FcstType=dwml")); my $forecast_arr = XMLin($forecast_xml->content); my ($item) = grep 'k-p12h-n13-1' eq $_->{'layout-key'}, @{ $forecast_arr->{data}[0]{'time-layout'} }; my @names = map $_->{'period-name'}, @{ $item->{'start-valid-time'} }; print "@names\n";