There may be a better (faster) way, but here's how I'd do it...

### collect the data to search for and open the file here

foreach $LINE(<FILE>)
{
        ($ID,$DEPT,$FNAME,$MNAME,$LNAME,$ADD,$CITY,$STATE,$ZIP,$PHONE) =
split(/\,/,$LINE);
        if ($LNAME =~ /$COLLECTED_DATA/i)
        {
                print $LINE;  ### formatted however...
                last;
        }
        else
        {
                next;
        }
}

It would run faster, I think, if you put it in an array and sort it by the
field you are using as a key. Not sure about this, tho.

-Pete



-----Original Message-----
From: Kelly Zhu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 04, 2000 4:05 PM
To: Perl-Win32-Users Mailing List
Subject: search directory


I believe somebody must have done this before.  What I try to do is to allow
web visitors to search a directory looking like this:

"ID","DEPT","FNAME","MNAME","LNAME","ADD","CITY","STATE","ZIP","PHONE"
"0265367","ECR","NATHAN","RASHAD","DAVIS","","","","","254-234-4567"
"0231534","WLT","ALFREDO","","RESENDEZ","","","","",""
"0304842","BET","JUSTIN","RAY","DAVIS","123 CHAPEL
RD","WACO","TX","76712","254-234-7890"
"0282286","ACT","LANCE","","WOOTEN","2010 CAMPUS
DR.","WACO","TX","76705","254-123-4567"

As you can see, it's a comma delimited flat database, with each field double
quoted, all in cap.

If lname "DAVIS" is searched,
"0265367","ECR","NATHAN","RASHAD","DAVIS","","","","","254-234-4567"
"0304842","BET","JUSTIN","RAY","DAVIS","123 CHAPEL
RD","WACO","TX","76712","254-234-7890"
will be displayed without quotes and in a table format.

Thanks for help.

Kelly



---
You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to