#!/usr/bin/env perl use strict; use warnings; use 5.24.0; use WWW::Wunderground::API; my $w = new WWW::Wunderground::API( location => '12123', api_key => 'nxnxnxnx', # API value concealed; your own is freely avail at Wunderground auto_api => 1, lang => 'EN', ); my $home_location = 'Xxxx, XX'; # capture location print "Enter city or zip code ($home_location): "; my $location = <>; chomp $location; binmode STDOUT, ':utf8'; # for degrees symbol # print source_time say "\n WeatherUnderground forecast as of " . scalar localtime . "\n"; # print header printf "%-10s%-6s%-6s%-8s%-20s\n", 'Time', "TempF", "TempC", 'Rain %', 'Conditions'; # print hourly for (@{ $w->hourly }) { printf "%8s%6i%6i%8i %-30s\n", $_->{FCTTIME}{civil}, $_->{temp}{english}, $_->{temp}{metric}, $_->{pop}, $_->{condition}; } #### C:>weather.pl Enter city or zip code (Xxxxx): Xxxxx WeatherUnderground forecast as of Sun Nov 6 11:34:26 2016 Time TempF TempC Rain % Conditions malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at C:/Perl/site/lib/WWW/Wunderground/API.pm line 113. #### $self->raw($result); if ($format !~ /(json|xml)/) { $self->data->{$action} = $self->raw(); return $self->raw(); } my $struc = $format eq 'json' # <--- LN 113 here ? decode_json($self->raw) : XMLin($self->raw);