#!/usr/bin/perl ##use CGI ':standard'; ## Store the data here my %data; @keywords = (); ##Get the string to search $search=param('search'); print "Content-type:text/html\n\n"; #Content Header print < Display Results End_of_head open (FH, " ) { if (/\\s*(\D*)$search/i ) { get_data(); print_data(); cleararray(); } } print < End_of_Doc sub get_data { while( ) { $data{author} = $1 if /\\s*(\D*)/i; $data{year} = $1 if /\\s*(\d{4})/i; $data{source} = $1 if /\\s*(\D*)/i; $data{id} = $1 if /\\s*(\d+)/i; push(@keywords, $1) if /\\s*(\w+)/i; ## store keys in an array $data{title} = $1 if /\\s*(\D*)/i; return if /\<\/ref\>/; } } sub print_data{ print <