#!/usr/bin/perl use CGI ':standard'; print header(), start_html("File search"); if (param()) { my $file = param("upload"); my $word = param("keyword"); print h1("Searching $file for $word"); print "
\n";
while (<$file>) {
s/&/&/g;
s/"/"/g;
s/</g;
s/>/>/g;
s{$word}{$&}ig;
print;
}
print "\n";
print hr();
}
print start_multipart_form(-method => 'POST'),
"Word to search for?", textfield('keyword'), br(),
filefield('upload'), br(),
submit("Search"),
end_form();
print end_html();