A L wrote: > Thanks for helping me on my previous question; I was able to get it > afterwards. I have another question. First, I have 3 arrays and > wanted to print out the items of corresponding places in a > sequential order. I have tried using foreach function, like > below foreach $a (@1){ foreach$b (@2){ foreach $c (@3){ > $tog=$a."\t".$b."\t".$c"\n"; print $tog; > } The way that it is handled would be the most inner loop would keep printing over and over while looping through 2 and then back to 1 and down.
The easiest way would be to find the largest array (ie scalar(@a), scalar(@b)) Then use that number for the highest loop. Create an id and loop through. If you know the arrays are ALWAYS the same size fine, but if different then would either need a check or set an undefined item to say a space. for(my $MyId=0;$MyId < $MyLaregstArray : $MyId++ ) { printf "%-26s -26s %-26s\n", $a[$MyId}, $b[$MyId}, $c[$MyId]; } Should give you a start. Wags ;) > } > } > But, it gets stuck in the first round with 1st items of @1 and @2 > with all the items of @3; then, it goes next with 2nd items of @1 and > @2 with all the items of @3 and on and on until the end. I thought > that I could use a push or pop function to not print all the items of > @3 every time. But, I couldn't. How can I get the loop to print > one items of @3 at each time and get out of the third inner loop > after one group of items? Following is what I am trying to do: > @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. A > > > > > --------------------------------- > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]