in reply to Accessing array elements
Consider the different values that $i will assume as the loop runs. Potentially just print out $i like:
print "Slot[$i]: $array[$i*2], port: $array[$i*2 + 1]\n" [download]