[prog] Introduction and Perl: Flat File DB Query Question

Kathryn Andersen kat_lists at katspace.homelinux.org
Wed Mar 15 07:33:47 EST 2006


On Tue, Mar 14, 2006 at 07:07:28PM +0000, Sabine Konhaeuser wrote:
[snip]
> $rc_data is the text file that holds the store locations delimited with pipes.
> $zipdb is the zip dbm holding zip codes and their longitudes and latitudes.
> 
> What happens is that both locations (1 and 2 from the above example) are 
> displayed when j=0 and also when j=1, but I would only want to have each 
> location displayed once, not twice.
> 
> My question is now, how do I force this code to not show duplicates? In SQL I 
> use DISTINCT. Is there some equivalent to DISTINCT for getting results in 
> flat text files? I could not find anything online. At this time a DB driven 
> approach is unfortunately not an option for this client.

No, there isn't a DISTINCT equivalent, you're just reading in lines from
the file.  You would have to do it programatically.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe


More information about the Programming mailing list