hi, how do i reset a foreach loop so that it starts at the top each time? a sample of my code looks like:
foreach $zrec (@file) # file with agent and city { chomp($zrec); foreach $zkey (@template) # put agent city data into hash { $hash{$zkey},$zrec)=split(/\//,$zrec,2); } foreach $zrec2 (@list) # table with city and zipcode { chomp($zrec2); foreach $zkey2 (@template2) # put city zipcode data into hash { ($hash2{$zkey2}, $zrec2)=split(/\//,$zrec2,2); } last if ($hash{city} eq $hash2{city}); } print "agent='$hash{agent}' city='$hash{city}' zipcode='$hash2{zipcode}'\n"; } the code looks like it should work ... but the 2nd and 3rd foreach loops do not behave as expected. :( i have read about 'reset' and 'continue blocks' but have not been able to make them reset the foreach loops and @list processing to work as i would like them to. two questions: 1. EXACTLY how should the code be written to ALWAYS start a foreach loop at the beginning? 2. EXACTLY how should the code be written so that a foreach loop on a @list ALWAYS starts at the beginning of a @list? thanks, jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]