Oops! I tested your code by reading the data from a text file to build @data, and it worked fine. While trying to
run your code with the rest of my code( I have built @data by parsing an XML file using XML::XPath), I'm getting errors similar to this
Operation `/': no method found,
left argument in overloaded package
XML::XPath::Literal,right argument has no
overloaded magic at C:\..\xmlrecord_parse.pl line 608.
Tool completed with exit code 255
So I've changed this portion of code, but I'm not sure if this is correct :
return 5 if (int($_[0]) >= 40);
return 0 if (int($_[0]) < 20);
return ((int($_[0]) / 5) - 3);
However, the results printed now are:
1-1-2004 5-1-2004 mild
Whereas they should be:
1-1-2004 5-1-2004 mild
10-1-2004 14-1-2004 very warm
Data
1-1-2004 15.0
2-1-2004 15.5
3-1-2004 16.5
4-1-2004 17.0
5-1-2004 17.5
6-1-2004 18.0
7-1-2004 18.5
8-1-2004 19.0
9-1-2004 19.5
10-1-2004 25.0
11-1-2004 26.5
12-1-2004 27.5
13-1-2004 28.0
14-1-2004 29.5
15-1-2004 28.0
16-1-2004 28.8
What do I need to change in the code?
Thanks,
perl_seeker :)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.