Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have two arrays corresponding to data points on a graph - e.g one array contains the x-values, the other contains the y-values (all are in order so $x_value[0] is paired with $y_value[0] etc). I basically want a quick way of looking up each pair from the two arrays are re-formating them like so: (value_from_y , value_from_x); The problem is that I am working within a foreach loop iterating over 96 lines (and doing this for each line) and it is also within a CGI which chocked after ~ line 22 with my effort below. If anyone knows of a more efficient way to do this I would be very happy.
for (0 .. scalar (@x_values)) { $gradient_array[$_] = '(' . $x_values[$_] . ',' . $y_values[$_] . +')'; }
update (broquaint): fixed formatting
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pairing values from two arrays
by broquaint (Abbot) on May 13, 2003 at 09:39 UTC | |
by zby (Vicar) on May 13, 2003 at 09:44 UTC | |
by broquaint (Abbot) on May 13, 2003 at 09:54 UTC | |
by zby (Vicar) on May 13, 2003 at 10:28 UTC | |
by broquaint (Abbot) on May 13, 2003 at 10:32 UTC | |
by Anonymous Monk on May 13, 2003 at 11:26 UTC | |
Re: Pairing values from two arrays
by BrowserUk (Patriarch) on May 13, 2003 at 10:20 UTC | |
Re: Pairing values from two arrays
by arturo (Vicar) on May 13, 2003 at 12:21 UTC | |
Re: Pairing values from two arrays
by edoc (Chaplain) on May 13, 2003 at 10:08 UTC | |
Re: Pairing values from two arrays
by Skeeve (Parson) on May 13, 2003 at 09:37 UTC |