Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello zejames!
Thanks a lot for your reply. I do not understand your code fully, please bear with me. What
are the variables last_range and first_day used for, and what should their initial values be?

Also for this line,
my $range = $day->[1] - ($day->[1] % 5);
I get this error:
Operation `%': no method found,left argument in overloaded package XML +::XPath::Literal,right argument has no overloaded magic at C:\..\xmlr +ecord_parse.pl line 604.
Using sprintf removes the error, but I'm not sure whether this is correct(i.e. the control string "%f"):
my $range = sprintf("%f","$day->[1]") - (sprintf("% f","$day->[1]") % 5);
My array of arrays @data looks like this:
[ 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 ],
So the resulting array of arrays I need to build should look like this:
1-1-2004 5-1-2004 mild 10-1-2004 14-1-2004 verywarm
The values of $range (printing inside the loop)I'm getting are:
15 15.5 15.5 15 15.5 15 15.5 15 15.5 25 25.5 25.5 25 25.5 25 25.8
This statements does not print anything:
print "$first_day $day->[0] ".$ranges{$range}."\n";
Please help, really need it!

Thanks,
perl_seeker:)

In reply to Re^2: Searching in an array of arrays by perl_seeker
in thread Searching in an array of arrays by perl_seeker

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (3)
    As of 2021-01-23 04:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?