Gossamer Forum
Home : Products : DBMan : Customization :

Help with IF statement

Quote Reply
Help with IF statement
Hi,
Help needed, I have DB setup and I was wondering if there is a simpler way of doing the following.
What I have is
open (DB, "<$db_file_name") or &cgierr("error in count. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB,1); }
@lines = ;
close DB;
foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
++$total_count;
++$count{$data[1]}; # date
#Change bgcolor for different types
if ($data[2] eq "CAR") { print qq| $data[2] |; }
if ($data[2] eq "BIKE") { print qq| $data[2] |; }
.
.
.
.
if ($data[2] eq "TRUCK") { print qq| $data[2] |; }

}

My question is, there a sorter way of performing this operation without doing all these IF statements.?

Help pls

Thanks
Colin W