> 
> In the below test you could create an array once of the cities that
> match, then just grep for the value in that city list with something like,
> 
> if (grep $fields[4] == $_, @cities) {
>   $tmptxt = $fields[10];
> }
> else {
>   $tmptxt = '1-' . $fields[10];
> }
> 
> No more copying and pasting, to add a city just add it to the array.
> 
> >    if ($fields[4] == "RALEIGH"){ 
> >     $tmptxt = $fields[10];
> >    }


p.s. regardless of how you handle it, the above test needs to be done
with 'eq' rather than '=='.  == is the number equality test, 'eq' is the
string equality test, which is what you are testing... same goes for in
the 'grep' I provided...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to