James Lum wrote: > ... > 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"; > } >
I won't answer your question, but your code is really hard to understand. The first aim of every script should not be functioness or speed, instead readability is it. Self, if then there is a mistake in the script, it can easily be found by anybody. Your variables are @file ... of course data comes from a file this file seems to consist of agents and city, because whole your script is about cities, it's important to add to information that now agents are at work suggestion: @agents $zrec ... stands for an element consisting of agent and city it's not a record about Z :-) $zkey ... could be the agent or the city or something else, just call it $city or $agent or $something else @template ... what's the content of the template %hash ... you can see at the first char, that it's a hash, what's the content ... $zrec2, $zkey2 ... seems as the variable names are going out I hope I wasn't to hard. But I don't want always to spend most of my time, only to understand what the script SHALL do. Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]