Shalabh wrote:

> i have a | delimited text data file and i want a perl script which
> accepts an input from a textbox on a html page(search.html) and search the
> lines containing that string and displays them in a html page
> format(show.html). Any help is appreciated. the html code for search. html
> and show.html are.


With DBD::AnyData you can use pipe delimited files like they were tables
in a SQL database, so if you have any experience with DBI this is
probably the way to go. That way, in the future you'll be able to
upgrade this text file to a real database changing only few lines of
your code. See:

http://search.cpan.org/search?module=DBD::AnyData

Alternatively, you can use AnyData::Format::Pipe to access your file
like it was a Perl hash. Take a look at:

http://search.cpan.org/search?module=AnyData
http://search.cpan.org/search?module=AnyData::Format::Pipe

This is an example from AnyData::Format::Pipe man page:

use AnyData;
my $table = adHash( 'Pipe', $filename,'r',$flags );
while (my $row = each %$table) {
     print $row->{name},"\n" if $row->{country} =~ /us|mx|ca/;
}

which is almost exactly what you are trying to do. It prints "name"
fields of every row containing "us", "mx" or "ca" in its "country"
field. You have to tune it to your own file format.

--
ZSDC



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to