in reply to Re: Re: Using Perl to Implement a simple Searchable Web Database
in thread Using Perl to Implement a simple Searchable Web Database
This should get you started...
#!/usr/bin/perl -wT use strict; use CGI; my $q = new CGI; my $number_to_find = $q->param("number"); open DATA, "data.txt" or die "Can't open file: $!"; while (<DATA>) { chomp; my @fields = split /,/; if ($fields[0] eq $number_to_find) { print_to_browser(@fields); } } close DATA; sub print_to_browser { my @data = @_; print $q->header("text/html"), $q->start_html("Error"), $q->h1("Relevant Data"), $q->p(@data), $q->end_html; }
That's definately not the prettiest code, but it should give you an idea of what you need to do. You'll probably also want to read some of the CGI.pm docs and do a search or two on cpan for "CSV" to find some relevant modules.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Using Perl to Implement a simple Searchable Web Database
by Anonymous Monk on May 28, 2002 at 18:28 UTC |