--On Thursday, October 2, 2003 14:31 -0700 A L <[EMAIL PROTECTED]> wrote:

@1        @2        @3
item1a    item1b    item1c
item2a    item2b    item2c
    .             .              .
    .             .              .
    .             .              .
They all have an equal number of items. I think there is a function
I could use.  Can you tell me what it is called and I can look up
the information.  Thanks for your help.

Ok, if you can guarantee that each array has the same number of items, here is what you want: (There are more Perlish ways to do this, but this way is clear on what is happening.)


for ( $i = 0; $i < @1; $i++; )
{
   print "$1[$i]\t$2[$i]\t$3[$i]\n";
}

What we are doing here is stepping through the arrays simultaneously, starting at the bottom. We assume all the arrays are exactly as long as @1. (Um, you do have better names in the real code, right?) $i is the index of our current place in all the arrays, and will cycle from 0 to the length of @1 minus 1.

You didn't need all the .'s and "'s, so I left them out. ;-)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to