in reply to Re^2: Regex to Array lookup question
in thread Regex to Array lookup question

When using a __DATA__ segment, you can't use an __END__ segment. Delete that __END__ line that you added. This is the reason that I embedded the output as a Perldoc instead of attaching the output after an __END__ segment.

Also, add "use strict;" to the code like I did. This will help you as you experiment with the code.

Update: this error: "JSON error at line 110, byte 2639/2647: Unexpected character '_' parsing initial state: expecting whitespace: 'n', '\r', '\t', ' ' at ./1.marshall.pl line 8, <DATA> line 1." Is complaining about the first underscore in the __END__ line that you added. The result is invalid JSON syntax. Error messages are often hard to figure out.

Replies are listed 'Best First'.
Re^4: Regex to Array lookup question
by Aldebaran (Curate) on Apr 07, 2020 at 06:28 UTC

    My mistake:

    $ ./1.marshall.pl URL = https://api.weather.gov/icons/land/day/tsra_sct,20/tsra_sct,40?s +ize=medium tsra_sct => 'Thunderstorm (medium cloud cover)' URL = https://api.weather.gov/icons/land/day/rain_showers,30/tsra_hi,3 +0?size=medium tsra_hi => 'Thunderstorm (low cloud cover)' URL = https://api.weather.gov/icons/land/night/rain_showers,30/rain_sh +owers?size=medium rain_showers => 'Rain showers (high cloud cover)' URL = https://api.weather.gov/icons/land/day/bkn?size=medium bkn => 'Mostly cloudy' $
      This is more like a "boo-boo" than a mistake. I am glad that you can run my code now. Let the Monks know how to help you further.