Re: bad code, needs work...

2004-02-10 Thread R. Joseph Newton
LoneWolf wrote: > Here's what I have, and I am sure there is a better way to do this... > > The problem I am getting is checking to see if one field matches the city, > and if it does keeping it the same, however if it does not it needs to have > a "1-" added to the front of that field... I think

Re: bad code, needs work...

2004-02-10 Thread Wiggins d Anconia
> > 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 pas

Re: bad code, needs work...

2004-02-10 Thread Wiggins d Anconia
Looping is your friend :-)... > Here's what I have, and I am sure there is a better way to do this... > > The problem I am getting is checking to see if one field matches the city, > and if it does keeping it the same, however if it does not it needs to have > a "1-" added to the front of that

bad code, needs work...

2004-02-10 Thread LoneWolf
Here's what I have, and I am sure there is a better way to do this... The problem I am getting is checking to see if one field matches the city, and if it does keeping it the same, however if it does not it needs to have a "1-" added to the front of that field... <-- CODE --> #!/usr/bin/perl -w