This is Perl - easy things are easy, and difficult things are possible ;)

Okay, this is a fairly dirty hack - but it should do the trick. You need to change the for loop that extracts the information from the @lines array to look like this:

for my $line (@lines) { if ($line =~ /^Forecast for/ && !$adeldesc) { while ($lines[$cnt++] ne "") { $adeldesc .= " $lines[$cnt]"; } } if ($line =~ /^([\w\s]+):.*?Max\s+(\d+)/) { $cities{$1}{max} = $2; } $cnt++; }

The change is the insertion of the while loop at the top, which basically says: "If the next line is not blank, append its contents to the $desc variable. (There always appears to be a blank line before the precis forecast).

This gives me the following output:

var adeldesc = " Fine, with high cloud. Cool to mild with light to mod +erate northeast to northwest winds. " var mtbkmax = "15" var noarmax = "16" var adelmax = "17" var elizmax = "17"

Cheers,
Darren :)


In reply to Re^7: weather fetching script by McDarren
in thread weather fetching script by pip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.