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

Re: Pairing values from two arrays

by arturo (Vicar)
on May 13, 2003 at 12:21 UTC ( #257701=note: print w/replies, xml ) Need Help??

in reply to Pairing values from two arrays

Just a point that I didn't see made in any of the other responses, although broquaint's code doesn't have this problem: scalar @array returns the number of things in the array; but since arrays are 0 indexed, that means that on the last iteration of the loop

for( 0..scalar(@x_values) )
you're accessing undefined values in the two arrays you're attempting to coordinate. Perl may be complaining about that if you have warnings on, and if this processing takes place before you output the headers, you might be confuzling your web server. For that reason and others:
for( 0 .. $#x_values )
is a better way to write it ( $#ARRAY_NAME is the value of the last index of the array with name ARRAY_NAME ).

If not P, what? Q maybe?
"Sidney Morgenbesser"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://257701]
[LanX]: and I'm sure I read that *hotel* used to be pronounced 'otel by the English upperclass
[Your Mother]: American English vowels are pretty lazy/mumbly in general.
[LanX]: talking about antisemitism, youtube automatic subtitles is entertaining shocking sometimes ... like when offering "Fruit Jews" as a drink
[Your Mother]: ...Come on you King of the Juice...
[Your Mother]: I actually know his kids.
LanX has to go/
[Your Mother]: King Herod's song (Mike D'Abo performed, I think)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-03-27 17:18 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.