in reply to Re: Searching in an array of arrays
in thread Searching in an array of arrays
I get this error:my $range = $day->[1] - ($day->[1] % 5);
Using sprintf removes the error, but I'm not sure whether this is correct(i.e. the control string "%f"):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.
My array of arrays @data looks like this:my $range = sprintf("%f","$day->[1]") - (sprintf("% f","$day->[1]") % 5);
So the resulting array of arrays I need to build should look 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 ],
The values of $range (printing inside the loop)I'm getting are:1-1-2004 5-1-2004 mild 10-1-2004 14-1-2004 verywarm
This statements does not print anything: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
Please help, really need it!print "$first_day $day->[0] ".$ranges{$range}."\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Searching in an array of arrays
by zejames (Hermit) on Nov 04, 2004 at 09:54 UTC | |
by perl_seeker (Scribe) on Nov 04, 2004 at 10:20 UTC |