in reply to Database question: pulling a particular field from a flat database
The first part of the script, shown below, looks through the db for the first field, or in this case, "ID" field. I want the first part of this script to use the "Listing" field instead of the "ID" field.ID|Category|Name|Image|Description|Price|Taxable|thumb|Listing
open DATA,$data; $line=<DATA>; @fields=split('\|',substr($line,0,index($line,";"))); %data=(); while (<DATA>) { my(@flds)=@fields; shift(@flds); my(@temp)=split('\|',substr($_,0,index($_,";"))); my($id)=shift(@temp); while ($#flds>-1) { if ($temp[0] eq "no") { $temp[0]=""; } $data{$id}{shift(@flds)}=shift(@temp); } } close DATA;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Elaboration on my Database question
by Sifmole (Chaplain) on Sep 05, 2001 at 18:44 UTC |